On 3 Aug 2012, at 15:38, rohit wrote:

> 
> Somewhat simpler:
> Artist.filter(:name => ['kinks', 'animals']).map(&:albums) 

That is definitely a lot nicer to look at!


On 3 Aug 2012, at 16:11, Jeremy Evans wrote:

> Well, with the dataset_associations plugin, that last example will work.
> 
> You could also use the filter by associations support:
> 
>   Album.where(:artists=>Artist.filter(:name => ["kinks", "animals"]))
> 
> I think in both cases, it uses a subselect instead of a join.  If you really 
> must have a join, you can use eager_graph:
> 
>   Album.eager_graph(:artists).where(:artists__name => ["kinks", 
> "animals"]).all

Thanks very much, that plugin looks exactly what I was looking for, and the 
filter by associations is also going to be really helpful with the stuff I'm 
doing.


Thank you both for taking the time to help me out, it's much appreciated.

Regards,
Iain

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to