How do I run multiple objects through an IF statement in rails?

Posted by codyvbrown on Stack Overflow See other posts from Stack Overflow or by codyvbrown
Published on 2010-05-24T21:56:11Z Indexed on 2010/05/24 22:01 UTC
Read the original article Hit count: 193

Filed under:
|

I am creating an application that highlights user messages from a stream based on whether or not the user has been 'vouched'. It works fine if it's setup for a single author. For example

controller: @vouch = Vouch.last.vouched_user_nickname

view: <% if tweet.from_user == @vouch %> <div class="flit_message_containerh">....

But I'm having trouble doing it for multiple user nicknames.

@vouch =  Vouch.find(:all,
      :select => "vouched_user_nickname", 
      :group => 'vouched_user_nickname'                  

)

Any ideas would be greatly appreciated. I'm a rails noob.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby