I have the following code (somewhat simplified ...
create_table :signatures do |t|
t.integer :signer_id
t.integer :card_id
t.timestamps
end
User should be defined like this:
class User < ActiveRecord::Base
has_many :sent_cards, :class_name => "Card", :foreign_key => "sender_id"
has_many :received_cards, :class_name => "Card", :foreign_key => "recipient_id"
has_many :signatures
has_many :signed_cards, :through => :signatures, :source => :card
end
When your association name is different than the name used at the :through you have to define the source parameter. If you look at the exception message it explicitly asks you to do it.