Skip to content

Commit

Permalink
Merge pull request theforeman#140 from ohadlevy/excplict-table-name
Browse files Browse the repository at this point in the history
fixes #11950 scopes now uses full table name in conditions.
  • Loading branch information
iNecas committed Sep 25, 2015
2 parents 6d949e8 + 6bac54c commit 8e724da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/foreman_tasks/task.rb
Expand Up @@ -31,14 +31,14 @@ class Task < ActiveRecord::Base
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 :running, -> { where("state NOT IN ('stopped', 'paused')") }
scope :active, -> { where('foreman_tasks_tasks.state != ?', :stopped) }
scope :running, -> { where("foreman_tasks_tasks.state NOT IN ('stopped', 'paused')") }
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)
scope :for_action_types, (lambda { |action_types| where('label IN (?)', Array(action_types)) })
scope :for_action_types, (lambda { |action_types| where('foreman_tasks_tasks.label IN (?)', Array(action_types)) })

def input
{}
Expand Down

0 comments on commit 8e724da

Please sign in to comment.