Displaying 1 result from an estimated 1 matches for "was_spanked_by".
2006 Nov 02
4
Still Having Problems With :through When Going To Same Table... Help... please :-(
I am having a problem with doing a :through that goes back to the same table.
The following are my two classes:
>>>>>
class User < ActiveRecord::Base
has_many :spanks
has_many :spanked, :through => :spanks, :source => :spanked_user
has_many :was_spanked_by, :through => :spanks, :source => :user
end
class Spank < ActiveRecord::Base
belongs_to :spanker, :class_name => "User", :foreign_key => "user_id"
belongs_to :spankee, :class_name => "User", :foreign_key => "spanked_user_id"
end
db_t...