Displaying 1 result from an estimated 1 matches for "find_by_studio_id".
2006 Aug 16
3
Question RE Rails associations
...possible alternatives, but none of them
really satisfy-- or, at least, I think it should be able to be done
better. My possible choices are:
1. Use straight SQL -- disregarded as not the "Ruby Way"
2. Use find_by_sql -- ditto (although, perhaps less so)
3. Do the following:
Movie.find_by_studio_id(<studio id>).collect do |movie|
movie.actors.each.do |actor|
if (actor.id == <actor id>) then
<do work>
end
end
end
This is not satisfying because I have to loop through all actors
associated with each movie to see if I have a matc...