Hi,
What's the difference between attr_accessor and attr_accessible?
Is attr_accessor to create a virtual variable/object and attr_accessible makes it accessible? Do you need attr_accessible if you already have attr_accessor?
Thanks!
Hi,
What's the difference between attr_accessor and attr_accessible?
Is attr_accessor to create a virtual variable/object and attr_accessible makes it accessible? Do you need attr_accessible if you already have attr_accessor?
Thanks!
Hi,
What's the difference between attr_accessor and attr_accessible?
They're completely unrelated. attr_accessor is a pure ruby method and creates a setter & getter method for an instance variable.
attr_accessible (and its counterpart attr_protected) are railsisms and are there to control which properties of an object a user can change through mass assignment
Fred
Thanks - what's mass assignment? Assigning attributes to an object?
This is mass assignment:
`User.new(params[:user])
Basically assigning all the attributes to the an instance based on the params[:user] hash. `