Thanks for the response.
I'm afraid my initial post wasn't clear as it could be. I am trying to
find a specific syntax to access an accessor getter/setter using a
variable, in this example "x":
user = User.new(:login=> "foo", :password=>"bar") # :password is not
a column in the db, but defined in the model using
"attr_accessor :password" (see initial post)
[:login, :password].each do |x|
original_val = user[x]
user[x] = some_new_val
do_some_test(user)
user[x] = original_val
end
It works for :login which is an actual attribute of User. However,
since :password was created as an attribute accessor (def password &
def password=), the syntax "user[e]" doesn't work. I'm looking for a
way to make this work while keeping "attr_accessor :password"
I hope this is clearer.
Thanks for the assist.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---