Created
November 17, 2010 20:16
-
-
Save glv/703997 to your computer and use it in GitHub Desktop.
USE INDEX with Active Record finders for Rails 3
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
# for background, see http://m.onkey.org/use-index-with-active-record-finders | |
# and http://twitter.com/#!/dougalcorn/status/4963159878139904 | |
from = "#{quoted_table_name} USE INDEX(index_activities_on_created_at_and_country_id)" | |
Activity.from(from).where('created_at >= ? AND country_id = ?', 10.days.ago, 79).all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment