Displaying 1 result from an estimated 1 matches for "my_answers".
Did you mean:
my_answer_
2006 Apr 03
0
with_scope used in a has_many :through model
Hi there,
I have something like the following:
class Person < AR:B
...
...
has_many :votes
has_many :chosen_answers, :through => :votes, :source => :answer, :select => ''DISTINCT answers.*'' do
def my_answers(whodunnit)
chosen_answers.with_scope(:find => { :conditions => [ "votes.created_by=?", whodunnit ] }) do
chosen_answers.find :all
end
end
end
Its somewhat of a contrived example, but I''m trying to understand if/how
it can work.
If i try:
p=Person.find :f...