What do you knew about virtual attriburtes in rails ? Generally we can get 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 http://mywayonrails.wordpress.com/2013/04/01/virtual-attributes-in-rails/#more-174.<http://mywayonrails.wordpress.com/2013/04/01/virtual-attributes-in-rails/> Thanks Sriram -- 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/BcA7M0V8zSQJ. For more options, visit https://groups.google.com/groups/opt_out.
sree ilapakurthy wrote in post #1108220:> What do you knew about virtual attriburtes in rails ? Generally we can > get > 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 >http://mywayonrails.wordpress.com/2013/04/01/virtual-attributes-in-rails/#more-174.<http://mywayonrails.wordpress.com/2013/04/01/virtual-attributes-in-rails/> 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. Example: attr_accessible :name is essentially equivalent to def name @name end def name=(name) @name = name end -- 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.