mirror of
				https://github.com/redmine/redmine.git
				synced 2025-10-31 18:36:07 +01:00 
			
		
		
		
	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:
		| @@ -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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user