Difference between attr_accessor and attr_accessible
18:07 28 Jun 2010

In Ruby on Rails, what is the difference between attr_accessor and attr_accessible?

From my understanding, using attr_accessor is used to create getter and setter methods for that variable, so that we can access the variable like Object.variable or Object.variable = some_value.

I read that attr_accessible makes that specific variable accessible to the outside world. What’s the difference?

ruby-on-rails ruby