Skip to content

Eliminate deprecation warnings in ActiveRecord 5.2 #296

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Feb 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/closure_tree/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Model
touch: _ct.options[:touch],
optional: true)

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

has_many :children, *_ct.has_many_with_order_option(
class_name: _ct.model_class.to_s,
Expand Down
2 changes: 1 addition & 1 deletion lib/closure_tree/numeric_deterministic_ordering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _ct_sum_order_by(node = nil)
node_score = "(1 + anc.#{_ct.quoted_order_column(false)}) * " +
"power(#{h['total_descendants']}, #{h['max_depth'].to_i + 1} - #{depth_column})"

"sum(#{node_score})"
Arel.sql("SUM(#{node_score})")
end

def roots_and_descendants_preordered
Expand Down