summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb b/lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb
index d069da972..34fa34560 100644
--- a/lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb
+++ b/lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb
@@ -46,8 +46,10 @@ module ActiveRecord
belongs_to :parent, :class_name => name, :foreign_key => configuration[:foreign_key], :counter_cache => configuration[:counter_cache]
has_many :children, :class_name => name, :foreign_key => configuration[:foreign_key], :order => configuration[:order], :dependent => configuration[:dependent]
- scope :roots, where("#{configuration[:foreign_key]} IS NULL").order(configuration[:order])
-
+ scope :roots, lambda {
+ where("#{configuration[:foreign_key]} IS NULL").
+ order(configuration[:order])
+ }
send :include, ActiveRecord::Acts::Tree::InstanceMethods
end
end