2

What the question says, Is it possible to merge two relations in an OR fashion instead of resolving and adding as arrays?

I want to avoid resolving to arrays but would be nice to have the syntax shown in https://stackoverflow.com/a/15236011/1520364, i.e a + b

Community
  • 1
  • 1
Karthik T
  • 31,456
  • 5
  • 68
  • 87

1 Answers1

2

The support for OR has been merged about 8 days ago, so if you use the HEAD version you can use it like:

Post.where('id = 1').or(Post.where('id = 2'))

# => SELECT * FROM posts WHERE (id = 1) OR (id = 2)

You can the the merged pull request here

Paulo Fidalgo
  • 21,709
  • 7
  • 99
  • 115