This repository was archived by the owner on Mar 30, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed
lib/squeel/adapters/active_record/4.0
spec/squeel/adapters/active_record Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 77* Fix NoMethodError when calling unscope method above Rails 4. By @estum
88* Fix error when including HABTM or HMT associations without eager loading.
99 Fixes #326 .
10+ * Ordering sequence is now correct when chaining multiple order methods. Fixes #276 .
1011
1112## 1.2.1 (2014-07-18)
1213
Original file line number Diff line number Diff line change @@ -160,10 +160,12 @@ def order!(*args)
160160
161161 # if a symbol is given we prepend the quoted table name
162162 args = args . map { |arg |
163- arg . is_a? ( Symbol ) ? "#{ quoted_table_name } .#{ arg } ASC" : arg
163+ arg . is_a? ( Symbol ) ?
164+ Arel ::Nodes ::Ascending . new ( klass . arel_table [ arg ] ) :
165+ arg
164166 }
165167
166- self . order_values = args + self . order_values
168+ self . order_values + = args
167169 self
168170 end
169171
Original file line number Diff line number Diff line change @@ -776,7 +776,6 @@ module ActiveRecord
776776 if MYSQL_ENV
777777 User . first . groups . to_sql . should match /#{ Q } memberships#{ Q } .#{ Q } active#{ Q } = 1/
778778 else
779- puts User . first . groups . to_sql
780779 User . first . groups . to_sql . should match /#{ Q } memberships#{ Q } .#{ Q } active#{ Q } = 't'/
781780 end
782781
@@ -836,6 +835,11 @@ module ActiveRecord
836835 relation . to_sql . should match /ORDER BY #{ Q } people#{ Q } .#{ Q } id#{ Q } ASC/
837836 end
838837
838+ it 'orders chain in correct sequence' do
839+ relation = Article . order { id . asc } . order { title . desc }
840+ relation . to_sql . should match /#{ Q } articles#{ Q } .#{ Q } id#{ Q } ASC, #{ Q } articles#{ Q } .#{ Q } title#{ Q } DESC/
841+ end
842+
839843 end
840844
841845 describe '#reorder' do
You can’t perform that action at this time.
0 commit comments