@@ -6,7 +6,7 @@ module Model
66
77 included do
88
9- belongs_to :parent , nil , *_ct . belongs_to_with_optional_option (
9+ belongs_to :parent , nil , ** _ct . belongs_to_with_optional_option (
1010 class_name : _ct . model_class . to_s ,
1111 foreign_key : _ct . parent_column_name ,
1212 inverse_of : :children ,
@@ -15,11 +15,11 @@ module Model
1515
1616 order_by_generations = -> { Arel . sql ( "#{ _ct . quoted_hierarchy_table_name } .generations ASC" ) }
1717
18- has_many :children , *_ct . has_many_with_order_option (
18+ has_many :children , *_ct . has_many_order_with_option , ** {
1919 class_name : _ct . model_class . to_s ,
2020 foreign_key : _ct . parent_column_name ,
2121 dependent : _ct . options [ :dependent ] ,
22- inverse_of : :parent ) do
22+ inverse_of : :parent } do
2323 # We have to redefine hash_tree because the activerecord relation is already scoped to parent_id.
2424 def hash_tree ( options = { } )
2525 # we want limit_depth + 1 because we don't do self_and_descendants.
@@ -28,25 +28,21 @@ def hash_tree(options = {})
2828 end
2929 end
3030
31- has_many :ancestor_hierarchies , *_ct . has_many_without_order_option (
31+ has_many :ancestor_hierarchies , *_ct . has_many_order_without_option ( order_by_generations ) ,
3232 class_name : _ct . hierarchy_class_name ,
33- foreign_key : 'descendant_id' ,
34- order : order_by_generations )
33+ foreign_key : 'descendant_id'
3534
36- has_many :self_and_ancestors , *_ct . has_many_without_order_option (
35+ has_many :self_and_ancestors , *_ct . has_many_order_without_option ( order_by_generations ) ,
3736 through : :ancestor_hierarchies ,
38- source : :ancestor ,
39- order : order_by_generations )
37+ source : :ancestor
4038
41- has_many :descendant_hierarchies , *_ct . has_many_without_order_option (
39+ has_many :descendant_hierarchies , *_ct . has_many_order_without_option ( order_by_generations ) ,
4240 class_name : _ct . hierarchy_class_name ,
43- foreign_key : 'ancestor_id' ,
44- order : order_by_generations )
41+ foreign_key : 'ancestor_id'
4542
46- has_many :self_and_descendants , *_ct . has_many_with_order_option (
43+ has_many :self_and_descendants , *_ct . has_many_order_with_option ( order_by_generations ) ,
4744 through : :descendant_hierarchies ,
48- source : :descendant ,
49- order : order_by_generations )
45+ source : :descendant
5046 end
5147
5248 # Delegate to the Support instance on the class:
0 commit comments