Created
November 7, 2014 11:13
-
-
Save mrbrdo/58afe9da5a318d10ef75 to your computer and use it in GitHub Desktop.
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
BlogsDatasource.new(Blog.all) | |
.select(:id, posts: { scope: Post.all, select: [:id, :author_name] }).results | |
# (0.1ms) SELECT blogs.id FROM "blogs" | |
# (0.2ms) SELECT posts.id, posts.blog_id, (posts.author_first_name || ' ' || posts.author_last_name) as author_name FROM "posts" WHERE (posts.blog_id IN (1)) | |
PostsDatasource.new(Post.all) | |
.select(:id, :title, :author, :author_name).results | |
# (0.1ms) SELECT posts.id, posts.title, posts.author_first_name, posts.author_last_name, (posts.author_first_name || ' ' || posts.author_last_name) as author_name FROM "posts" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment