Displaying 1 result from an estimated 1 matches for "communicator_to_m".
2006 Jul 12
5
DRY version of RoR book PAYMENT_TYPES example
...presentation. I know that I can add a Hash to
a model: IM = {''S'' => ''Skype'', ''A'' => ''AIM''}, and in views call it: <%=
User::IM[user.communicator] %>. But I would be more DRY if in views you
could use: <%= user.communicator_to_m %>.
This shouldn''t be difficult to implement:
- add Hash to a model: FIELDNAME_TYPES = [[''S'',''Skype''],[''A'',''AIM'']]
- create additional methods like fieldname_to_m which will get a value
and convert it to human re...