All works fine for call of only one Tag like: Post.tagged("sport") .
The problem comes when you want to show the adverts that have any tag
OR other, like well: Post.tagged(%w{sport people}). Then, the INNER
JOIN do that I may get repeated results of Post. For example, if I may
have two Post with "sport" and "people" tag each one, with the
previous call, I would get 4 results.
I'm trying to use "select('DISTINCT *')" but it doesn't work. Sure, de
INNER JOIN between Post and Tagging result of table that all rows are
distinct. If we supost the next:
Using "select("DISTINCT posts.id, posts.title")" method I think I
could get it but it isn't clean. Really, my Posts table have a lot of
attributtes. Some advice? Thanks.
The finded scope is for return an ActiveRecord array instead do the
common find method. Yes, it's not too smart solution but, for the
moment, it's working and while I'm trying to find a more clean
solution and I'm attentive for your answers and advices. Thanks!