Reputation: 17900
I have the following models defined:
house_firm.rb
class HouseFirm < ActiveRecord::Base
has_many :house_firm_group_links
has_many :house_firm_groups, through: :house_firm_group_links
end
house_firm_group.rb
class HouseFirmGroup < ActiveRecord::Base
has_many :house_firm_group_links
has_many :house_firms, through: :house_firm_group_links
end
house_form_group_link.rb
class HouseFirmGroupLink < ActiveRecord::Base
belongs_to :house_firm
belongs_to :house_firm_group
end
However, when I do:
@house_firm = HouseFirm.new
@house_firm.house_firm_groups
I receive:
NameError at /house_firms/new
uninitialized constant HouseFirm::HouseFirmGroupLink
What am I doing wrong and how can I fix this?
Upvotes: 0
Views: 1167
Reputation: 51151
You have a typo in the name of the file implementing HouseFirmGroupLink
class, it should be named house_firm_group_link.rb
.
Upvotes: 6