Em 07-04-2012 10:35, James Coleman escreveu:
You can use the same code with a call like:
    model.attributes = {}
where the example was update_attributes({}). That won't attempt to save the model. And either of those calls will assign with any overridden accessors too, so you won't be bypassing them.


Hi James, thank you for the follow ups. Actually I was already using attributes= combined with this:

http://api.rubyonrails.org/classes/ActiveModel/MassAssignmentSecurity/ClassMethods.html

But I wasn't aware that it would call the overridden methods. Thanks for getting that to my attention. I've just taken a look at the sources to be sure:

https://github.com/rails/rails/blob/ceb33f84933639d3b61aac62e5e71fd087ab65ed/activerecord/lib/active_record/attribute_assignment.rb#L33

Thanks :)

Rodrigo.

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Core" 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-core?hl=en.

Reply via email to