Created
September 15, 2014 18:28
-
-
Save mattraykowski/55fb15638b268c797479 to your computer and use it in GitHub Desktop.
Testing safe_like out.
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
[7] pry(main)> person.last_name | |
=> "Raykowski" | |
[8] pry(main)> Person.safe_like(:last_name, "ray%") | |
Person Load (1.7ms) SELECT "people".* FROM "people" WHERE "people"."site_id" = 1 AND ("people"."last_name" ILIKE 'ray%') | |
=> [<1:Matt Raykowski>] | |
[9] pry(main)> Person.where(first_name: 'Matt') | |
Person Load (1.2ms) SELECT "people".* FROM "people" WHERE "people"."site_id" = 1 AND "people"."first_name" = 'Matt' | |
=> [<1:Matt Raykowski>] | |
[10] pry(main)> Person.where(first_name: 'Matt').safe_like(:last_name, 'ray%') | |
Person Load (1.1ms) SELECT "people".* FROM "people" WHERE "people"."site_id" = 1 AND "people"."first_name" = 'Matt' AND ("people"."last_name" ILIKE 'ray%') | |
=> [<1:Matt Raykowski>] | |
[11] pry(main)> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment