File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 11
22* 3.1.0 *
33
4+ * Allow complex order objects to not be molested by our visitor overrides. Fixes #99
5+
46* Default unicode datatypes!
57
68* New #lowercase_schema_reflection configuration that allows you to downcase all tables and columns.
Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ def order(*exprs)
3535 table = Arel ::Table . new ( x . relation . table_alias || x . relation . name )
3636 expr = table [ x . name ]
3737 Arel ::Nodes ::Ordering . new expr
38+ when Arel ::Nodes ::Ordering
39+ x
3840 when String
3941 x . split ( ',' ) . map do |s |
4042 expr , direction = s . split
Original file line number Diff line number Diff line change 44require 'models/joke'
55require 'models/subscriber'
66require 'models/minimalistic'
7+ require 'models/post'
78
89class AdapterTestSqlserver < ActiveRecord ::TestCase
910
10- fixtures :tasks
11+ fixtures :tasks , :posts
1112
1213 def setup
1314 @connection = ActiveRecord ::Base . connection
@@ -18,6 +19,12 @@ def setup
1819
1920 context 'For abstract behavior' do
2021
22+ should 'not mangel complex order clauses' do
23+ xyz_order = "CASE WHEN [title] LIKE N'XYZ%' THEN 0 ELSE 1 END"
24+ xyz_post = Post . create :title => 'XYZ Post' , :body => 'Test cased orders.'
25+ assert_equal xyz_post , Post . order ( Arel ::Nodes ::Ordering . new ( Arel . sql ( xyz_order ) ) ) . first
26+ end
27+
2128 should 'have a 128 max #table_alias_length' do
2229 assert @connection . table_alias_length <= 128
2330 end
You can’t perform that action at this time.
0 commit comments