File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 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
3535 hierarchy_class = model_class . parent . const_set ( short_hierarchy_class_name , Class . new ( ActiveRecord ::Base ) )
3636 use_attr_accessible = use_attr_accessible?
3737 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
3940 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
4243 attr_accessible :ancestor , :descendant , :generations if use_attr_accessible
4344 def ==( other )
4445 self . class == other . class && ancestor_id == other . ancestor_id && descendant_id == other . descendant_id
@@ -47,7 +48,7 @@ def ==(other)
4748 def hash
4849 ancestor_id . hash << 31 ^ descendant_id . hash
4950 end
50- RUBY
51+ end
5152 hierarchy_class . table_name = hierarchy_table_name
5253 hierarchy_class
5354 end
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ def dont_order_roots
8080 end
8181
8282 def nulls_last_order_by
83- "-#{ quoted_order_column } #{ order_by_order ( reverse = true ) } "
83+ "-#{ quoted_order_column } #{ order_by_order ( true ) } "
8484 end
8585
8686 def order_by_order ( reverse = false )
You can’t perform that action at this time.
0 commit comments