MJFuzz
2010-Apr-24 13:23 UTC
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?? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
MJFuzz
2010-Apr-24 13:28 UTC
Re: Searching activerecord result arrays "include?" does not work.
Never mind.. I was searching on the value and not checking if the class exists in the array.. duh.. On Apr 24, 9:23 am, MJFuzz <mjaff...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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?? > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Apr-24 13:32 UTC
Re: Searching activerecord result arrays "include?" does not
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 marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.