validations of "type" when using Single Table Inheritance

Sorry if I'm just dumbing out, but is there a reason that when using Single Table Inheritance Rails doesn't really validate the "type" field or provide some mechanism to do so? seems like a good way to corrupt a database. Because the "type" is also a special attribute, I had to resort to an ugly hack like:

  class ActiveRecord::Base     def type_attr       self[: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!

Yes, although it could be changed manually (unlikely) or injected from cgi parameters, which is what the validations are supposed to prevent, no?