Skip to content

Commit

Permalink
fixes #11950 - scopes now uses full table name in conditions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ohadlevy committed Sep 24, 2015
1 parent bc37f15 commit 6bac54c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/foreman_tasks/task.rb
Original file line number Diff line number Diff line change
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 6bac54c

Please sign in to comment.