Last active
October 13, 2017 09:23
-
-
Save surendrans/51a500e725bc214f507ca11d4557aa85 to your computer and use it in GitHub Desktop.
rails5 or condition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User.where(gender: 'M').or("age > 22") | |
#SELECT "users".* FROM "users" WHERE ("users"."gender" = ? OR "users"."age" > ?) [["gender", 'M'], ["age", "22"]] | |
User.where(gender: 'M').or(user.where("age > 22")) | |
#SELECT "users".* FROM "users" WHERE ("users"."gender" = ? OR "users"."age" > ?) [["gender", 'M'], ["age", "22"]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment