Searching activerecord result arrays "include?" does not work

I’m racking my brain with this and I know there’s an easy way to do
this.

I have a Model.find result array. I need to check to see if a value
exists in that array result. Array.include? always returns false I
assume cause its an array of objects. So how do I search the resulting
array??

Never mind… I was searching on the value and not checking if the
class exists in the array… duh…

MJFuzz wrote:

I’m racking my brain with this and I know there’s an easy way to do
this.

I have a Model.find result array. I need to check to see if a value
exists in that array result. Array.include? always returns false I
assume cause its an array of objects. So how do I search the resulting
array??

Why do you need to? Normally you should let the DB do things like this.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs