Displaying 1 result from an estimated 1 matches for "subclass_of".
Did you mean:
subclasses_of
2007 Jul 06
2
validations of "type" when using Single Table Inheritance
...[:type]
end
def self.validates_type(options={})
validates_inclusion_of :type_attr, options
end
end
so that I could write:
class Fruit < ActiveRecord::Base
validates_type :allow_nil => true,
:in => %w{ Apple } # could be dynamic
subclass_of but make faster!
(obviously this could also have been put on the derived class)
Thanks!
--~--~---------~--~----~------------~-------~--~----~
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 rub...