Re: disable protected attributes for create or save

Frederick Cheung
2008-10-29T15:00:41Z

On 29 Oct 2008, at 14:53, Marcelo Barbudas wrote:

>
> Hi,
>
> Is there a way to temporarily disable attr_protected for create and
> save method calls?
>
> Something like save_without_protected...
>
The bit to realise is that it''s not save that''s doing the
protecting -
it''s the assigning to attributes.

Something like

foo  = SomeObject.new
foo.send :attributes=, some_attributes, false
foo.save

will create a new instance of foo, ignoring protected attributes.

Fred

> --
> M.
> >


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