Hi again,

I have these functions - about five of them - and they are all the exact
same code except for which object instances they are referencing. For
example, if I have a user object and each user can modify one of five
phone fields - home, work, cell, etc. - I would like to call one
function and just pass a varibale indicating which one I am modifying.

I tried something like the following with no luck:

def change_phone(variable)
 ....
 @user."#{varibale}" = @phone
end

where variable was work, for example. But it throws an error "Unexpected
STRING_BEG". If there a way to do what I am doing? Thanks,

-S
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to