やあ、仲間の開発者、
@chapter.articlesを呼び出すと、Rails で次のエラーが発生します。
uninitialized constant Sommaire::Chapter::Article
:class_name => "Sommaire::Article"を指定すると、次のようになります。
uninitialized constant Sommaire::Chapter::Sommaire::Article
私はレール(3.0.0)に比較的慣れていないので、これは私を失いました!
よろしくお願いします。JD
sommaire.rb
のクラス
のコードの下
class Sommaire < ActiveRecord::Base
has_many :chapters
end
sommaire/chapter.rbで
class Sommaire::Chapter < ActiveRecord::Base
include ItemBase
def self.table_name
'sommaire_chapters'
end
belongs_to :sommaire
has_many :articles, :class_name => "Sommaire::Article"
validates_presence_of :title, :description
end
sommaire/article.rbで
class Sommaire::Article < ActiveRecord::Base
include ItemBase
def self.table_name
'sommaire_articles'
end
belongs_to :chapter
end