« Return to Thread: Question on attr_protected and attr_accessible

Re: Question on attr_protected and attr_accessible

by Adam Akhtar-2 :: Rate this Message:

Reply to Author | View in Thread


Frederick Cheung wrote:

> On Jul 9, 3:18�pm, "�lph� Bl��" <rails-mailing-l...@...>
> wrote:
>>
>> If I set this to attr_protected :admin
>>
>> .. I'm unable to access that attribute and won't be able to update my
>> admins..
>
> Not quite true. it means that you can't do some_user.update_attributes
> (:admin => true).
>
> You can however do some_user.admin = true
>
> The attr_accessible/attr_protected mechanism is a bit of a blunt tool.
> There has been some discussion about revisiting this for rails 3
>
> Fred

Thanks for the clarification Fred.  So, how would I implement this in my
edit view template?  Or, are you stating it can't be done there but
somewhere else?

<%= f.label :admin? %><br />
<%= f.check_box :admin %>

--
Posted via http://www.ruby-forum.com/.

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

 « Return to Thread: Question on attr_protected and attr_accessible