diff options
author | Ben Toews <mastahyeti@gmail.com> | 2017-09-25 10:13:53 -0600 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2017-11-09 22:37:23 +1030 |
commit | 92e78593ee056bb73a7a87c10af3f2587eca1150 (patch) | |
tree | 95cc5db66bd163b67dd0e80b12d48a21a9913d96 /activerecord | |
parent | 0d8626ad3f1bac3b814d554147ff7926c0380fad (diff) | |
download | rails-92e78593ee056bb73a7a87c10af3f2587eca1150.tar.gz rails-92e78593ee056bb73a7a87c10af3f2587eca1150.tar.bz2 rails-92e78593ee056bb73a7a87c10af3f2587eca1150.zip |
work with actual string when reversing order
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 4c63d0450a..7fe0129b4a 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -1075,6 +1075,9 @@ module ActiveRecord when Arel::Nodes::Ordering o.reverse when String + # ensure we're not dealing with string subclass (Eg. Arel::Nodes::SqlLiteral) + o = String.new(o) + if does_not_support_reverse?(o) raise IrreversibleOrderError, "Order #{o.inspect} can not be reversed automatically" end |