Hi,
I was trying to understand stored values vs display values.
model code
CLUB_TYPES = [
Displayed stored in db
[ “Public” , “pub” ],
[ “Village” , “vil” ],
[ “Private” , “pvt” ]
]
validates_inclusion_of :club_type, :in =>
CLUB_TYPES.map {|disp, value| value}
#view code
<%= f.select :club_type, Club::CLUB_TYPES, :prompt => “Select a Club
Type” %>
This works fine for getting data into the database.
My question: Is there a helper to get the display value back from the
database? If not, could somebody show me how to correct the following
to get the display value rather than the stored value.
Club Type:
<%= @club.club_type %>
Thanks