Created
September 3, 2010 03:58
-
-
Save jimsynz/563393 to your computer and use it in GitHub Desktop.
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
$ gem install rails --version=3.0.0 | |
$ rails new ArelBug | |
$ cd ArelBug | |
$ rails generate model post text:string type:string | |
$ rails generate model mention post_id:integer user_id:integer | |
$ rake db:create db:migrate | |
$ rails console | |
> pt = Post.arel_table | |
> mt = Mention.arel_table | |
# SELECT "posts"."id" FROM "mentions" INNER JOIN "posts" ON "posts"."id" = "mentions"."post_id" WHERE "mentions"."user_id" = 14 AND "posts"."type" != 'ReTweet' | |
> Benchmark.measure { mt.join(pt).on(pt[:id].eq(mt[:post_id])).where(mt[:user_id].eq(14)).where(pt[:type].eq('ReTweet').not).project(pt[:id]) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment