Ruby on rails Rails NameError has\ u MUN:THRONG关系中未初始化的常量
我定义了以下模型: 豪斯公司Ruby on rails Rails NameError has\ u MUN:THRONG关系中未初始化的常量,ruby-on-rails,ruby,associations,has-many-through,Ruby On Rails,Ruby,Associations,Has Many Through,我定义了以下模型: 豪斯公司 class HouseFirm < ActiveRecord::Base has_many :house_firm_group_links has_many :house_firm_groups, through: :house_firm_group_links end 我收到: NameError at /house_firms/new uninitialized constant HouseFirm::HouseFirmGroupLink 我
class HouseFirm < ActiveRecord::Base
has_many :house_firm_group_links
has_many :house_firm_groups, through: :house_firm_group_links
end
我收到:
NameError at /house_firms/new
uninitialized constant HouseFirm::HouseFirmGroupLink
我做错了什么?我如何解决这个问题?您在实现
house firmgrouplink
类的文件名中有一个输入错误,它应该命名为house\u firm\u group\u link.rb
您在实现HouseFirmGroupLink
类的文件名中有一个输入错误,应该将其命名为house\u firm\u group\u link.rb
哦…盯着三个文件看了15分钟,想找一个打字错误,但找不到一个…万分感谢!哦…盯着三个文件看了15分钟,想找一个打字错误,但找不到一个…万分感谢!
class HouseFirmGroupLink < ActiveRecord::Base
belongs_to :house_firm
belongs_to :house_firm_group
end
@house_firm = HouseFirm.new
@house_firm.house_firm_groups
NameError at /house_firms/new
uninitialized constant HouseFirm::HouseFirmGroupLink