Skip to content

Commit 217162c

Browse files
authoredFeb 2, 2018
Merge pull request #296 from Envek/fix/rails-5-2-deprecations
Eliminate deprecation warnings in ActiveRecord 5.2
2 parents dc464ac + 0d9cbb0 commit 217162c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎lib/closure_tree/model.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module Model
1313
touch: _ct.options[:touch],
1414
optional: true)
1515

16-
order_by_generations = "#{_ct.quoted_hierarchy_table_name}.generations asc"
16+
order_by_generations = Arel.sql("#{_ct.quoted_hierarchy_table_name}.generations ASC")
1717

1818
has_many :children, *_ct.has_many_with_order_option(
1919
class_name: _ct.model_class.to_s,

‎lib/closure_tree/numeric_deterministic_ordering.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _ct_sum_order_by(node = nil)
6565
node_score = "(1 + anc.#{_ct.quoted_order_column(false)}) * " +
6666
"power(#{h['total_descendants']}, #{h['max_depth'].to_i + 1} - #{depth_column})"
6767

68-
"sum(#{node_score})"
68+
Arel.sql("SUM(#{node_score})")
6969
end
7070

7171
def roots_and_descendants_preordered

0 commit comments

Comments
 (0)