I m new to ruby language. difference between att_accesor and attr_accessible is not clear to me. thanks for your kind help. kp (india) -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-Dec-21 13:37 UTC
Re: difference between attr_accesor and attr_accesible
On Dec 21, 12:20 pm, kp <pariharkirt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I m new to ruby language. difference between att_accesor and > attr_accessible is not clear to me. >They''re almost completely unrelated. attr_accessor is part of ruby itself and is equivalent to calling attr_writer and attr_reader for the same argument(s), ie it creates accessor methods for you attr_accessible is a rails thing and is part of rails'' mass assignment protection (along with attr_protected). It allows you to setup a whitelist of attributes that can be mass-assigned (as opposed to attr_protected, which sets up a blacklist) so that users can''t set important attributes they''re not supposed to be able to set just by manipulating the form data that is posted Fred> thanks for your kind help. > kp > (india)-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
kirti parihar
2010-Dec-21 17:58 UTC
Re: Re: difference between attr_accesor and attr_accesible
hey...thanks for help. On Tue, Dec 21, 2010 at 7:07 PM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Dec 21, 12:20 pm, kp <pariharkirt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I m new to ruby language. difference between att_accesor and > > attr_accessible is not clear to me. > > > > They''re almost completely unrelated. attr_accessor is part of ruby > itself and is equivalent to calling attr_writer and attr_reader for > the same argument(s), ie it creates accessor methods for you > > attr_accessible is a rails thing and is part of rails'' mass assignment > protection (along with attr_protected). It allows you to setup a > whitelist of attributes that can be mass-assigned (as opposed to > attr_protected, which sets up a blacklist) so that users can''t set > important attributes they''re not supposed to be able to set just by > manipulating the form data that is posted > > Fred > > thanks for your kind help. > > kp > > (india) > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.