diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-06-07 17:15:27 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-06-07 17:17:51 +0900 |
commit | 7cc67a368c518150e09efedd892a2af7a534b482 (patch) | |
tree | 0a2ee3a4925575d76616b15a27a31711a88ff640 /activerecord/test | |
parent | 770f8f345fe92f09b01461920becc409d201f739 (diff) | |
download | rails-7cc67a368c518150e09efedd892a2af7a534b482.tar.gz rails-7cc67a368c518150e09efedd892a2af7a534b482.tar.bz2 rails-7cc67a368c518150e09efedd892a2af7a534b482.zip |
NULLS { FIRST | LAST } is safe SQL string since 6c82b6c99d86f37e61f935fb342cccd725d6c7d4
There is no need to be wrapped by `Arel.sql()`.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 91353e4f9e..732bca4bf5 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -337,21 +337,21 @@ class RelationTest < ActiveRecord::TestCase def test_reverse_order_with_nulls_first_or_last assert_raises(ActiveRecord::IrreversibleOrderError) do - Topic.order(Arel.sql("title NULLS FIRST")).reverse_order + Topic.order("title NULLS FIRST").reverse_order end assert_raises(ActiveRecord::IrreversibleOrderError) do - Topic.order(Arel.sql("title NULLS FIRST")).reverse_order + Topic.order("title NULLS FIRST").reverse_order end assert_raises(ActiveRecord::IrreversibleOrderError) do - Topic.order(Arel.sql("title nulls last")).reverse_order + Topic.order("title nulls last").reverse_order end assert_raises(ActiveRecord::IrreversibleOrderError) do - Topic.order(Arel.sql("title NULLS FIRST, author_name")).reverse_order + Topic.order("title NULLS FIRST, author_name").reverse_order end assert_raises(ActiveRecord::IrreversibleOrderError) do - Topic.order(Arel.sql("author_name, title nulls last")).reverse_order + Topic.order("author_name, title nulls last").reverse_order end - end + end if current_adapter?(:PostgreSQLAdapter, :OracleAdapter) def test_default_reverse_order_on_table_without_primary_key assert_raises(ActiveRecord::IrreversibleOrderError) do |