use lambda form in acts_as_tree scope (#12499)
git-svn-id: http://svn.redmine.org/redmine/trunk@12487 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
e17bf40fe1
commit
a5f028a242
|
@ -46,8 +46,10 @@ module ActiveRecord
|
||||||
belongs_to :parent, :class_name => name, :foreign_key => configuration[:foreign_key], :counter_cache => configuration[:counter_cache]
|
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]
|
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
|
send :include, ActiveRecord::Acts::Tree::InstanceMethods
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue