what is the correct way of doing a many-to-many self-referencing relationship in active record?
I have the following active record models:
class Relationship < ActiveRec开发者_如何学Cord::Base
belongs_to :user
belongs_to :follower, :class_name => 'User', :foreign_key => 'follower_id'
end
class User < ActiveRecord::Base
has_many :relationships
has_many :followers, :through => :relationships
end
I get an error when I try user.followers.
ArgumentError: Unknown key(s): identifier from /home/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib /active_support/core_ext/hash/keys.rb:43:in `assert_valid_keys'
精彩评论