From b02a6936f7156f9615d63abac0a96da07ca59e0e Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 7 Mar 2019 17:04:25 +0900 Subject: [PATCH] Fix incorrect identifier quoting [ci skip] --- activerecord/lib/active_record/relation/query_methods.rb | 4 ++-- guides/source/active_record_querying.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 24a50db619..936d8321b0 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -243,10 +243,10 @@ def _select!(*fields) # :nodoc: # Allows you to change a previously set select statement. # # Post.select(:title, :body) - # # SELECT `posts.title`, `posts.body` FROM `posts` + # # SELECT `posts`.`title`, `posts`.`body` FROM `posts` # # Post.select(:title, :body).reselect(:created_at) - # # SELECT `posts.created_at` FROM `posts` + # # SELECT `posts`.`created_at` FROM `posts` # # This is short-hand for unscope(:select).select(fields). # Note that we're unscoping the entire select statement. diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index c9db99ca1d..24dea0ec46 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -819,19 +819,19 @@ Post.select(:title, :body).reselect(:created_at) The SQL that would be executed: ```sql -SELECT `posts.created_at` FROM `posts` +SELECT `posts`.`created_at` FROM `posts` ``` In case the `reselect` clause is not used, ```ruby -Post.select(:title, :body) +Post.select(:title, :body).select(:created_at) ``` the SQL executed would be: ```sql -SELECT `posts.title`, `posts.body` FROM `posts` +SELECT `posts`.`title`, `posts`.`body`, `posts`.`created_at` FROM `posts` ``` ### `reorder` -- GitLab