Created
May 10, 2016 15:26
-
-
Save dleve123/98f8b01d7c17543f15391b0a0ec44401 to your computer and use it in GitHub Desktop.
String Types Matter For Complicated ActiveRecord Queries
This file contains hidden or 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
[29] pry(main)> Clinic.where("subdomain LIKE ?", "%\_%") | |
=> [#<Clinic:0x007f8212b97b98 | |
id: 1, | |
name: "Factory Clinic 1", | |
subdomain: "factory-clinic-1", | |
privacy_policy: nil, | |
optional_data_sharing: false, | |
automated_texting: false, | |
company_id: 2>, | |
#<Clinic:0x007f8212b97a08 | |
id: 2, | |
name: "Factory Clinic 2", | |
subdomain: "factory-clinic-2", | |
privacy_policy: nil, | |
optional_data_sharing: false, | |
automated_texting: false, | |
company_id: 2>] | |
[30] pry(main)> Clinic.where("subdomain LIKE ?", '%\_%') | |
=> [] | |
# Note that the query on L30 has the expected output. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment