Displaying 1 result from an estimated 1 matches for "obligatory_field".
Did you mean:
obligatory_fields
2006 May 18
1
Introspection of validates_presence_of
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 understa...