0
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
#relationsships
has_many :petitions
#signatures
has_many :signatures
has_many :signed_petitions ,:through => :signatures , :class_name => 'Petitions' , :foreign_key => 'petition_id'
end
class Signatures < ActiveRecord::Base
belongs_to :signers, :class_name => 'User'
belongs_to :petitions
end
class Petition < ActiveRecord::Base
attr_accessible :letter, :about, :title, :goal
#relationships
belongs_to :user
#signature
has_many :signatures
has_many :signers ,:through => :signatures , :class_name => 'User'
end
私はこのエラーを取得しています:私は嘆願モデルを構築するために何が間違っていますか?
>Petition.first.signers
NameError: uninitialized constant Petition::Signature
その理由は、私の多対多の関係のdidntの仕事のように思えますか?
これはあなたの質問に答えましたか? [upvote /あなたの質問への回答を受け入れることを忘れないでください](http://meta.stackexchange.com/a/5235/158402) ':)' –