@new_relationships = User.select('*')
.from("(#{@rels_unordered.to_sql}) AS rels_unordered")
.joins("
INNER JOIN relationships
ON rels_unordered.id = relationships.character_id
ORDER BY relationships.created_at DESC
")
SELECT COUNT(*) FROM (SELECT .....
SELECT * FROM (SELECT .....
if @new_relationships.any?
Surprising possibly, but it saved a lot of processor time. Such is the magic of rails.
Colin
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/41ec5676-836d-4079-b48c-b28b49a5326d%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.