Reputation: 307
I'm using X-Editable to change a boolean value. Currently the dropdown gives two options, "Yes" and "No", however I would like to change that to "Active" and "Inactive".
<%= editable user, :active %>
I've tried to add the options like this:
<%= editable user, :active, [['Active', true], ['Inactive', false]] %>
However that throws the following NoMethodError:
undefined method `each_pair' for [["Active", true], ["Inactive", false]]:Array
Did you mean? each_slice
Upvotes: 0
Views: 155
Reputation: 7705
Try change your view code to this:
<%= editable user, :active, source: ['Active', 'Inactive'] %>
as mentioned in github:
source = [ "Active", "Disabled" ]
editable @model, :enabled, source: source
The best way to this is in respect to DRY also proposed in github
Upvotes: 2