The first thing you should know is that attar_accessible will be removed
from Rails 4 to be replaced by strong parameters.
See here for more:
The attar_accessor is really nothing more than a declarative statement
for specifying getters and setters for instance variable (which is
really all that virtual attributes are). In anything other than
ActiveRecord models “virtual attributes” are called “instance
variables.” Sometimes these are also called “transient variables”
because they are attributes that are to be excluded from persistence
either in a serialized format or persistent storage (database). Some
languages have specific syntax for transient variables although AFAIK
Ruby does not.
Example:
attr_accessible :name
is essentially equivalent to
def name @name
end
def name=(name) @name = name
end
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.