1
array_users = ["3581", "3592", "3665", "3730"]

@records = Model.find(
           :all, 
           :order => 'date desc', 
           :group => :date, 
           :conditions => {
                 :client_id => current_user.client.id,  
                 :user_id is present in array_users # <------------------
           })

How would one make certain that only the records returned have a user_id that is present in array_users using Rails 2.3.9?

3
  • Is there any reason you're not running v2.3.14? There's lots of important security fixes between there and v2.3.9. Commented Apr 12, 2012 at 3:55
  • Thanks for pointing this out. I was not aware of .14. Commented Apr 12, 2012 at 18:46
  • 1
    You should definitely ensure that you're using some method to keep updated on new versions, especially since any updates to 2.3 at this point are important security fixes. Commented Apr 12, 2012 at 20:01

1 Answer 1

4
:conditions => {
  :client_id => current_user.client.id,  
  :user_id => array_users
})

See the guide for all the possibilities with the hash conditions.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. Worked perfect, and for the ref guide. Great stuff in there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.