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
кажется, что мои отношения многие ко многим не сработали, почему?