1
編輯:解決了Rails的活動記錄:的has_many錯誤(NameError:未初始化的常數)
has_many :imagens, :class_name => 'Imagem', :dependent => :delete_all
我現在面臨的問題 長得像這樣的:Rails : uninitialized constant error on Active Record destroy
我iflections文件有以下幾種:
inflect.plural 'imagem', 'imagens'
inflect.singular 'imagens', 'imagem'
當我嘗試獲取im年齡,它提出和錯誤:
veiculo = Veiculo.first
veiculo.imagens #uninitialized constant Veiculo::Imagen
我不知道爲什麼會這樣
class Veiculo < ActiveRecord::Base
has_many :caracteristicas, :dependent => :delete_all
has_many :imagens, :dependent => :delete_all
# more irrelevant code
end
class Imagem < ActiveRecord::Base
belongs_to :veiculo
# more irrelevant code, has attached file
end