summaryrefslogtreecommitdiffstats
path: root/lib/plugins
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-01-07 10:02:50 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-01-07 10:02:50 +0000
commita5f028a2424e2e234081b6a84c496fb6c563ee9c (patch)
tree8f2aabcbbe30972ac8312333264d367811d1686a /lib/plugins
parente17bf40fe1eddafdb456c4068eb60e02ecf17394 (diff)
downloadredmine-a5f028a2424e2e234081b6a84c496fb6c563ee9c.tar.gz
redmine-a5f028a2424e2e234081b6a84c496fb6c563ee9c.zip
use lambda form in acts_as_tree scope (#12499)
git-svn-id: http://svn.redmine.org/redmine/trunk@12487 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/plugins')
-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