Hi, I´ve created an "acts_as" plugin where the user can add several attributes of his choice to the model. Now I´m looking for a way to allow the users to access all attributes without changing the plugin code e.g., now I set the accessors like this in the plugin code: cattr_accessor :first_name, last_name I am looking for something like this: attr_accessor :all Thanks for your help, bide --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
balint.erdi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Feb-06 00:02 UTC
Re: cattr_accessor for all attributes
obj.instance_variables might be the answer you are looking for, although attr_accessor :name will not create the corresponding instance variable. Also, are you sure :first_name and :last_name should be class attribute accessors and not instance ones (so plain attr_accessors)? Balint On Feb 5, 5:02 pm, bide <christmasb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I´ve created an "acts_as" plugin where the user can add several > attributes of his choice to the model. > Now I´m looking for a way to allow the users to access all attributes > without changing the plugin code > > e.g., now I set the accessors like this in the plugin code: > cattr_accessor :first_name, last_name > > I am looking for something like this: > attr_accessor :all > > Thanks for your help, > bide--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---