diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-12-12 12:31:35 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-12 12:31:35 -0500 |
commit | a681eaf22955734c142609961a6d71746cfa0583 (patch) | |
tree | d1593d8c5ecaa9c93ed734533a865782b214e95a /activerecord/test/cases | |
parent | ec68e5d42d20befd85cdf22dd5d516b1adda7012 (diff) | |
parent | 2d78c66cd918b2cfde0308c0e4327943c30894f8 (diff) | |
download | rails-a681eaf22955734c142609961a6d71746cfa0583.tar.gz rails-a681eaf22955734c142609961a6d71746cfa0583.tar.bz2 rails-a681eaf22955734c142609961a6d71746cfa0583.zip |
Merge pull request #31403 from Edouard-chin/fix-quoted-columnname
Quote colum_names when building select:
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 9e1b858bda..875b98f0b8 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1495,4 +1495,12 @@ class BasicsTest < ActiveRecord::TestCase # regular column assert query.include?("name") end + + test "column names are quoted when using #from clause and model has ignored columns" do + refute_empty Developer.ignored_columns + query = Developer.from("`developers`").to_sql + quoted_id = Developer.connection.quote_table_name("id") + + assert_match(/SELECT #{quoted_id}.* FROM `developers`/, query) + end end |