On Jan 15, 7:15 am, Robert Walker <[email protected]> wrote:
> While this is certainly on-topic based on the subject, I don't see that
> the OP is attempting any such thing in the examples provided. I still
> see no benefit to avoiding mass assignment based on what he's doing. If
> the code had any of the needs you mention here then update_attributes
> would be lacking.
>
> > [:name, :email].each do |attr|
> >  user.send("#{attr}=", params[:user][attr])
> > end
>
> This was what I was referring to when mentioning not seeing the benefit.
> How is this any safer than update_attributes coupled with
> attr_accessible or attr_protected?

The benefit for me is that I only want certain attributes to be
updated in certain controller contexts. I may have several attributes
on the user model that only the root user can update so I would set
them to protected in the model and can override it in the controller
when the user is root.

That makes sense right?

Andrew
-- 
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.


Reply via email to