diff --git a/app/controllers/foreman_tasks/api/tasks_controller.rb b/app/controllers/foreman_tasks/api/tasks_controller.rb index d2b784098..da21feffa 100644 --- a/app/controllers/foreman_tasks/api/tasks_controller.rb +++ b/app/controllers/foreman_tasks/api/tasks_controller.rb @@ -29,7 +29,7 @@ class TasksController < ::Api::V2::BaseController class BadRequest < Apipie::ParamError end - before_filter :find_resource, :only => [:show] + before_filter :find_task, :only => [:show] api :GET, "/tasks/summary", "Show task summary" def summary @@ -259,6 +259,10 @@ def task_hash(task) private + def find_task + @task = Task.find(params[:id]) + end + def resource_scope(options = {}) @resource_scope ||= ForemanTasks::Task.authorized("#{action_permission}_foreman_tasks") end diff --git a/app/controllers/foreman_tasks/tasks_controller.rb b/app/controllers/foreman_tasks/tasks_controller.rb index c7f3d28a3..669e95771 100644 --- a/app/controllers/foreman_tasks/tasks_controller.rb +++ b/app/controllers/foreman_tasks/tasks_controller.rb @@ -5,7 +5,7 @@ class TasksController < ::ApplicationController before_filter :restrict_dangerous_actions, :only => [:unlock, :force_unlock] def show - @task = find_resource + @task = Task.find(params[:id]) end def index @@ -14,7 +14,7 @@ def index end def sub_tasks - task = find_resource + task = Task.find(params[:id]) @tasks = filter(task.sub_tasks) render :index end