Quantcast
Channel: Rails 5: ActiveRecord OR query - Stack Overflow
Browsing latest articles
Browse All 6 View Live

Answer by Foram for Rails 5: ActiveRecord OR query

Rails 5 has ability for or clause with where.For Example.User.where(name: "abc").or(User.where(name: "abcd"))

View Article



Answer by Nicholas for Rails 5: ActiveRecord OR query

(Just an addition to the answer by K M Rakibul Islam.)Using scopes, the code can become prettier (depending on the eyes looking):scope a, -> { where(a) }scope b, -> { where(b) }scope a_or_b,...

View Article

Answer by mtrolle for Rails 5: ActiveRecord OR query

I needed to do a (A && B) || (C && D) || (E && F)But in Rails 5.1.4's current state this get's too complicated to accomplish with the Arel or-chain.But I still wanted to use...

View Article

Answer by Nitin for Rails 5: ActiveRecord OR query

We don't need to wait for rails 5 to use this OR query. We can also used it with rails 4.2.3. There is a backport here.Thank to Eric-Guo for gem where-or, Now we can add this OR functionality in >=...

View Article

Answer by K M Rakibul Islam for Rails 5: ActiveRecord OR query

The ability to chain or clause along with where clause in ActiveRecord query will be available in Rails 5. See the related discussion and the pull request.So, you will be able to do the following...

View Article


Rails 5: ActiveRecord OR query

How do you do an or query in Rails 5 ActiveRecord? Also, is it possible to chain or with where in ActiveRecord queries?

View Article
Browsing latest articles
Browse All 6 View Live




Latest Images