The answer is relatively simple.
Remember that statement when you first started learning Ruby: "In Ruby, everything is an object". Objects have methods, and to access an objects property you need an accessor
method.
The attr_accessor is a Ruby method that generates accessor methods for a given instance variable (check attr_reader and attr_writer).
So your question actually is whether you need to access those properties, outside the Model
.
And I think this answeres your question.
Important note: attr_accessible
is not a Ruby method. It's a Rails method that allows you to pass in values to Models for a mass assignment: new(attrs)
or update_attributes(attrs)
.