2014-04-29 24 views
0

當我填充我的數據庫時,獲取未初始化的常量Chef :: Meal錯誤。未初始化的常量在導軌中

我在模型中做錯了什麼?

廚師型號

class Chef < ActiveRecord::Base 
     has_many :meals 
end 

膳食模式

class Meals < ActiveRecord::Base 
    belongs_to :chef 
    validates :chef_id, presence: true 
end 

回答

2

更改模型名稱從MealsMeal

+0

謝謝,我已upvoted你的問題:) – jimagic

0

你擁有了一個Meals型號,它應該是單數即Meal

class Meal < ActiveRecord::Base 
    belongs_to :chef 
    validates :chef_id, presence: true 
end 

也看到這些Naming Conventions爲Rails

相關問題