Displaying 1 result from an estimated 1 matches for "spanked_user_id".
2006 Nov 02
4
Still Having Problems With :through When Going To Same Table... Help... please :-(
...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_table:spanks
id | user_id | spanked_user_id | created_at | updated_at
>>>>>
I want to be able to make statemets like:
john = User.find_by_nickname("john")
john.spanked
john.was_spanked_by
Can I do this without using a :finder_sql?
The above does not work....