I've clearly go a lot of repetition in the following methods:
def name=(value)
write_attribute(:name, if [0,"0",""," "].include? value then nil
else value end)
end
def address=(value)
write_attribute(:address, if [0,"0",""," "].include? value then nil
else value end)
end
def city=(value)
write_attribute(:city, if [0,"0",""," "].include? value then nil
else value end)
end
Can someone tell me the convention to DRY this code? I'm wondering if I
use a lambda but am not quite sure that's the right path or how to do
that.
Thanks,
Bill
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---