On Sat, Sep 10, 2011 at 21:36, jdkealy <jdke...@gmail.com> wrote:

> I have a complicated query for "matches"
>
> one criteria is that one's matches should not contain someone from
> your blocked list.
>
> in testing the matches method, i'm not sure how to test this.
>
> u = User.find(1)
> u.blockUser(2)
> u.matches.where(:user_id=>2).should be_empty
>
> however where is an invalid method for an array, i see... And I can't
> seem to do anything with the find method. Any ideas here?

Try this:

  u.matches.index { |match| match.user_id == 2 } == nil

-Dave

-- 
Main Web Site: davearonson.com | LOOKING FOR WORK,
Programming Blog: codosaur.us  | preferably RoR, in NoVa/DC;
Excellence Blog:  dare2xl.com  | see main web site.

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to