On Dec 16, 9:49 pm, John Merlino <[email protected]> wrote:
> Hence, you can now do @user.login - should login be a field in the
> database. If a value for login was captured in the param hash, then
> @user.login will return value passed from params hash.
>
> Does anyone have a general description of what ActiveRecord does behind
> the scenes to achieve this?
Barring some complication around protected attributes, multi parameter
assignments etc... the code behind all this boils down to
hash_of_attributes.each do |name, value|
send "#{name}=", value
end
Whether the method called is one backed by a database attribute or not
doesn't matter
Fred
--
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.