app/models
class Amodel < ActiveRecord::Base end class Bmodel < Amodel end class Cmodel < Bmodel end
db/migrate
create_table :amodels do |t| t.string :type end
on script/console...
$ script/console Loading development environment (Rails 2.3.4) >> Cmodel.create => #<Cmodel id: 1, type: "Cmodel"> >> Bmodel.find(:all) => [#<Cmodel id: 1, type: "Cmodel">]
ok, but Bmodel returns no records after rebooting console like:
>> exit $ script/console Loading development environment (Rails 2.3.4) >> Bmodel.find(:all) => []
however, it works after accessing Cmodel:
>> Cmodel => Cmodel(id: integer, type: string) >> Bmodel.find(:all) => [#<Cmodel id: 1, type: "Cmodel">]
Amodel works like:
>> exit $ script/console Loading development environment (Rails 2.3.4) >> Amodel.find(:all) => [#<Cmodel id: 1, type: "Cmodel">]
Does anyone know why it works like this?
Rails: 2.3.4
Ruby: 1.8.7
OS: Ubuntu 9.0.4