So I'm seeing this strange error when I try to do a fairly simple interactive test of an associations I've added. Here are the two models:
class Lot < ActiveRecord::Base
has_many :graves
belongs_to :block
end
class Grave < ActiveRecord::Base
belongs_to :lot
end
Here are the table creation migrations:
class CreateGraves < ActiveRecord::Migration
def change
create_table :graves do |t|
t.integer :grave_number
t.integer :lot_id
t.timestamps null: false
end
end
end
class CreateLots < ActiveRecord::Migration
def change
create_table :lots do |t|
t.integer :lot_number
t.integer :map_type
t.timestamps null: false
end
end
end
I'm invoking pry with:
pry -r ./config/environment.rb
Then in the pry session I simply do:
lot = Lot.new
l.graves
and I get this error:
NameError: uninitialized constant Lot::Grafe
from /.../activerecord-4.2.6/lib/active_record/inheritance.rb:158:in `compute_type'
The ... there is simply the path to my rbenv installation and the ruby 2.3.0 subdirectory chain. I replaced it in there to keep that output readable.
I've got several other similar associations defined on other classes and all of those work as expected.