On Mar 15, 2:38 pm, Mark Bush <m... / bushnet.org> wrote: > me wrote: > > And in method validate, I'd like to iterate through all the attributes > > and run their respective validating method. Is there a way for me to > > be able to iterate through my list of attr_accessor symbols and > > reference their names to know which method to call? > > If you just want to run the validates for the variables specified in the > "attr_accessor" methods and not for other instance variables, then you > could do something like this: > > class Event > @@attributes = [:a, :b, :c, :d] > @@attributes.each {|attr| attr_accessor attr} This line can also be written as: attr_accessor *@@attributes