attr_accessible & attr_accessor - what's the difference?

i'm still new to rails and working on digesting everything i come across. recently i came across these two. what is the difference between attr_accessor and attr_accessible?

They are completely unrelated. attr_accessible and its counterpart attr_protected are there to help avoid users injecting parameters via mass assignment (ie would ignore them).

attr_accessor is a ruby method that is the combination of attr_reader & attr_accessor: it creates a pair of accessor methods for an instance variable (Don't use this for database attributes - Rails creates those accessors for you)


typo: attr_reader and attr_writer :slight_smile: