エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
Rails 3 ActiveRecord query using both SQL IN and SQL OR operators
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Rails 3 ActiveRecord query using both SQL IN and SQL OR operators
I'm writing a Rails 3 ActiveRecord query using the "where" syntax, that uses both the SQL IN and ... I'm writing a Rails 3 ActiveRecord query using the "where" syntax, that uses both the SQL IN and the SQL OR operator and can't figure out how to use both of them together. This code works (in my User model): Question.where(:user_id => self.friends.ids) #note: self.friends.ids returns an array of integers but this code Question.where(:user_id => self.friends.ids OR :target => self.friends.usernames

