> So i'm tooling around with merb today and I created a model with an
> Enum type.
> How do i use this in a form?
I normally do something along the lines of:
class Blah
TYPES = [['Normal', 'normal'], ['Big', 'big'],['Small', 'small']]
TYPES_ENUM = Enum.new(*TYPES.map { |t| t[0] })
property :type, TYPES_ENUM
end
<%= select :type, :collection => Blah::TYPES,
:selected => @blah.type.to_s,
:prompt => "PLEASE SELECT",
:label => {:title => "Type" } %>
...never used a radio_group myself so not sure if this approach would
be useful for you or not. The idea of the TYPES array was so the text
in the select dropdown can be different to that stored in the db.
hth
Rupert
--
roovoweb.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---