|| at May 8, 2013 at 2:27 pm
sree ilapakurthy wrote in post #1108220:
What do you knew about virtual attriburtes in rails ? Generally we can
idea about attr_accessible and attr_accessor
so what these two can do . i found the difference between these two from
this blog. Very useful plz check it
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:http://weblog.rubyonrails.org/2012/3/21/strong-parameters/
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.
is essentially equivalent to
@name = name
Posted via http://www.ruby-forum.com/.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
To post to this group, send email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/groups/opt_out.