app/models/foreman_tasks/task.rb in foreman-tasks-0.3.5 vs app/models/foreman_tasks/task.rb in foreman-tasks-0.3.6

- old
+ new

@@ -20,11 +20,15 @@ scoped_search :in => :locks, :on => :resource_type, :complete_value => true, :rename => "resource_type", :ext_method => :search_by_generic_resource scoped_search :in => :locks, :on => :resource_id, :complete_value => false, :rename => "resource_id", :ext_method => :search_by_generic_resource scoped_search :in => :owners, :on => :login, :complete_value => true, :rename => "owner.login", :ext_method => :search_by_owner scoped_search :in => :owners, :on => :firstname, :complete_value => true, :rename => "owner.firstname", :ext_method => :search_by_owner - scope :active, -> { where('state != ?', :stopped) } + scope :for_resource, + (lambda do |resource| + joins(:locks).where(:"foreman_tasks_locks.resource_id" => resource.id, + :"foreman_tasks_locks.resource_type" => resource.class.name) + end) def input {} end