Skip to content

Commit 38714e8

Browse files
author
Eliezer Reis
committed
refactor(closure_tree/support.rb): refactor with_order_option, scope_with_order and has_many_order_with_option methods to use fully_qualified_order_by
1 parent a15ceb8 commit 38714e8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/closure_tree/support.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ def hierarchy_table_name
6666

6767
def with_order_option(opts)
6868
if order_option?
69-
opts[:order] = [opts[:order], order_by].compact.join(",")
69+
opts[:order] = [opts[:order], fully_qualified_order_by].compact.join(",")
7070
end
7171
opts
7272
end
7373

7474
def scope_with_order(scope, additional_order_by = nil)
7575
if order_option?
76-
scope.order(*([additional_order_by, order_by].compact))
76+
scope.order(*([additional_order_by, fully_qualified_order_by].compact))
7777
else
7878
additional_order_by ? scope.order(additional_order_by) : scope
7979
end
@@ -85,7 +85,7 @@ def has_many_order_without_option(order_by_opt)
8585
end
8686

8787
def has_many_order_with_option(order_by_opt=nil)
88-
order_options = [order_by_opt, order_by].compact
88+
order_options = [order_by_opt, fully_qualified_order_by].compact
8989
[lambda {
9090
order_options = order_options.map { |o| o.is_a?(Proc) ? o.call : o }
9191
order(order_options)

0 commit comments

Comments
 (0)