Get data from database with two conditions in one list
Posted
by
Kreeki
on Stack Overflow
See other posts from Stack Overflow
or by Kreeki
Published on 2010-12-31T15:25:16Z
Indexed on
2010/12/31
15:53 UTC
Read the original article
Hit count: 179
ruby-on-rails
Hi coders out there,
I'm new to this. I have a (sqlite3, but with ActiveRecord it doesn't matter) table called Messages and a model called Message. I want to find all messages in database that have user_id or reciever_id equal to the object user and his attribute id (for short user.id). I know it's probably just one simple line of code, but I wanna do it the right "rails" way and I don't have much experience with this.
I'm using Rails 3. Thanks for any help.
Cheers
© Stack Overflow or respective owner