Rails 2.3.8 Compound condition

Posted by Michael Guantonio on Stack Overflow See other posts from Stack Overflow or by Michael Guantonio
Published on 2013-10-23T21:38:36Z Indexed on 2013/10/23 21:54 UTC
Read the original article Hit count: 118

Filed under:
|

I have a rails query that I would like to run. The only problem that I am having is the query structure.

Essentially the query looks like this

queryList = model.find(:all, :conditions => [id = "id"])
#returns a query list

#here is the issue
compound = otherModel.find(:first, :select => "an_id", 
                                   :conditions => ["some_other_id=? and an_id=?, some_other_id, an_id])

Where an_id is actually a list of ids in the query list. How can I write that in rails to basically associate a single id to a list that may contain ids...

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby