Trouble with enum field

93 views
Skip to first unread message

Bill Lazar

unread,
May 25, 2012, 2:43:52 PM5/25/12
to rails_admin
I have a fairly simple (I hope) set up that just doesn't work right and I'd appreciate assistance in properly configuring it.

Model is Event, with a field called status, in the model I have a method status_enum that returns an array of strings and attr_accessible on the status field. In rails_admin.rb inside the Event model block I have:

config.model Event do
edit do
field :status
end
end

Result is the edit page shows the current value of the field, read only.

I also tried these variations with no different/better results:

config.model Event do
edit do
field :status, :enum
end
end


config.model Event do
edit do
field :status, :enum do
enum_method do
:status_enum
end
end
end

Thanks,
Bill

Benoit Bénézech

unread,
May 31, 2012, 8:06:51 AM5/31/12
to rails...@googlegroups.com
You need to check that status is attr_accessible.

Bill Lazar

unread,
May 31, 2012, 10:46:03 AM5/31/12
to rails_admin
Thanks that was the answer. Didn't remember that 3.2 required a_a and this started as a 3.0 project.

Similarly though I'm having trouble with two has_many associations:

Class Event
  has_many :presentations
  has_many :speakers, through: :presentations

attr_accessible ..., :speakers, :presentations

Neither show up as fields at all on the edit page.
Reply all
Reply to author
Forward
0 new messages