Created
September 1, 2014 18:09
-
-
Save fuzzmonkey/77a0d1065043a5e4e387 to your computer and use it in GitHub Desktop.
This code generates three SQL queries in ActiveRecord. Not what i was expecting..
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
foos = Foo.where(params) | |
if foos.any? | |
# Foo Load (0.1ms) select count from foos where params | |
if foos.size == 1 && foos.first.attribute == 'bar' | |
# Foo Load (0.1ms) select count from foos where params | |
# Foo Load (0.1ms) select * from foos where params | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment