Displaying 1 result from an estimated 1 matches for "fieldname_to_m".
2006 Jul 12
5
DRY version of RoR book PAYMENT_TYPES example
...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 readable form using model''s array/hash
Before I try to hack RoR I would like to get some feedback to learn if
above approach is good. Maybe the problem is already solved in a
different way or there is a plug-in which implement that idea....