Cattr_accessor for all attributes


#1

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


#2

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