Please quote when replying. Ich wrote in post #961576: > Don't work for me.
Are you using Rails 2 or 3? The syntax that you're responding to was for Rails 3 (or Rails 2 + Arel). > A last I use > > arreglo= Array.new > arreglo=solicituds.all(:select => > "convenio_id").map(&:convenio_id) > arreglo<<-1 > Convenio.where(["id NOT IN (?)",arreglo]) > I'm not happy but works. That's not even good SQL. I think you want something like this SQL: SELECT * FROM convenios c LEFT JOIN solicituds s ON (s.convenio_id = c.id AND s.usuario_id = :user_id) WHERE s.id IS NULL That gets everything in one query, and will be pretty easy to translate into AR find arguments, so you won't need find_by_sql here. Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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/rubyonrails-talk?hl=en.

