class CreateTests < ActiveRecord::Migration def self.up create_table :my_tests do |t| t.string :type t.timestamps end end def self.down drop_table :my_tests end end #MyTest.rb class MyTest < ActiveRecord::Base end #SubTest.rb class SubTest < MyTest end #SubSubTest.rb class SubSubTest < SubTest end #in a console MyTest.create SubTest.create SubSubTest.create SubTest.find(:all) # => SELECT * FROM `my_tests` WHERE ( (`my_tests`.`type` = 'SubTest' OR `my_tests`.`type` = 'SubSubTest' ) ) SubTest.find(:all) # Same thing: # => SELECT * FROM `my_tests` WHERE ( (`my_tests`.`type` = 'SubTest' OR `my_tests`.`type` = 'SubSubTest' ) ) ActiveRecord::Base.reset_subclasses SubTest.find(:all) # => SELECT * FROM `my_tests` WHERE ( (`my_tests`.`type` = 'SubTest' ) ) CreateTests.down