File tree 2 files changed +6
-5
lines changed
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,11 @@ def hierarchy_class_for_model
35
35
hierarchy_class = model_class . parent . const_set ( short_hierarchy_class_name , Class . new ( ActiveRecord ::Base ) )
36
36
use_attr_accessible = use_attr_accessible?
37
37
include_forbidden_attributes_protection = include_forbidden_attributes_protection?
38
- hierarchy_class . class_eval <<-RUBY , __FILE__ , __LINE__ + 1
38
+ model_class_name = model_class . to_s
39
+ hierarchy_class . class_eval do
39
40
include ActiveModel ::ForbiddenAttributesProtection if include_forbidden_attributes_protection
40
- belongs_to :ancestor, : class_name => " #{ model_class } "
41
- belongs_to :descendant, : class_name => " #{ model_class } "
41
+ belongs_to :ancestor , class_name : model_class_name
42
+ belongs_to :descendant , class_name : model_class_name
42
43
attr_accessible :ancestor , :descendant , :generations if use_attr_accessible
43
44
def ==( other )
44
45
self . class == other . class && ancestor_id == other . ancestor_id && descendant_id == other . descendant_id
@@ -47,7 +48,7 @@ def ==(other)
47
48
def hash
48
49
ancestor_id . hash << 31 ^ descendant_id . hash
49
50
end
50
- RUBY
51
+ end
51
52
hierarchy_class . table_name = hierarchy_table_name
52
53
hierarchy_class
53
54
end
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ def dont_order_roots
80
80
end
81
81
82
82
def nulls_last_order_by
83
- "-#{ quoted_order_column } #{ order_by_order ( reverse = true ) } "
83
+ "-#{ quoted_order_column } #{ order_by_order ( true ) } "
84
84
end
85
85
86
86
def order_by_order ( reverse = false )
You can’t perform that action at this time.
0 commit comments