class Meeting < ActiveRecord::Base
MEETING_TYPES = [['General' , 'g'],
['Special' , 's'],
['AGM' , 'a']]
end
I have generated scaffolding and the edit and create are working as
expected.
However in the list it is not displaying the correct meeting type, it
is displaying the value stored in the database (g,s,a) where I want
"General", "Special" or "AGM".
This is from my list.rhtml file...
<% for meeting in @meetings %>
<%=h meeting.send(:meeting_type) %>
<% end %>
I can see why it is displaying the database values but I'm not sure
how to retrieve the display values from the array or if there is some
rails helper/magic I should be using.
I tried using a hash which solved this problem but broke the create/
edit combobox.
Overriding the meeting_type caused a problem for the combobox - it
wasn't providing the correct value to the database so I named the
method meeting_type_display and it works well.