Hello all.
I don''t know how to get all symbols passed to method
validates_presence_of in model. I''ve trying to use following solution:
class News < ActiveRecord::Base
validates_presence_of :title, :text
def validates_presence_of(*attr_names)
@@obligatory_fields = attr_names
ActiveRecord::Base.validates_presence_of(*attr_names)
end
def obligatory_fields
@@obligatory_fields
end
end
But when object news was created i''ve got following error message:
uninitialized class variable @@obligatory_fields in News.
I don''t understand when object News call methods:
validates_presence_of, attr_accessible, attr_reader, etc.
Maybe someone know how to deal with this problem?
--
Serhiy Boiko, CRIS-UANIC