Fix before_filter deprecation

pull/6827/head
Oliver Günther 8 years ago
parent 26f2e4e2f5
commit 3bb19ff4d0
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 12
      app/controllers/cost_objects_controller.rb
  2. 4
      app/controllers/cost_types_controller.rb
  3. 6
      app/controllers/costlog_controller.rb
  4. 8
      app/controllers/hourly_rates_controller.rb
  5. 2
      lib/open_project/costs/patches/projects_controller_patch.rb

@ -18,16 +18,16 @@
#++ #++
class CostObjectsController < ApplicationController class CostObjectsController < ApplicationController
before_filter :find_cost_object, only: [:show, :edit, :update, :copy] before_action :find_cost_object, only: [:show, :edit, :update, :copy]
before_filter :find_cost_objects, only: :destroy before_action :find_cost_objects, only: :destroy
before_filter :find_project, only: [ before_action :find_project, only: [
:new, :create, :new, :create,
:update_material_budget_item, :update_labor_budget_item :update_material_budget_item, :update_labor_budget_item
] ]
before_filter :find_optional_project, only: :index before_action :find_optional_project, only: :index
before_filter :authorize_global, only: :index before_action :authorize_global, only: :index
before_filter :authorize, except: [ before_action :authorize, except: [
# unrestricted actions # unrestricted actions
:index, :index,
:update_material_budget_item, :update_labor_budget_item :update_material_budget_item, :update_labor_budget_item

@ -19,8 +19,8 @@
class CostTypesController < ApplicationController class CostTypesController < ApplicationController
# Allow only admins here # Allow only admins here
before_filter :require_admin before_action :require_admin
before_filter :find_cost_type, only: [:edit, :update, :set_rate, :destroy, :restore] before_action :find_cost_type, only: [:edit, :update, :set_rate, :destroy, :restore]
layout 'admin' layout 'admin'
helper :sort helper :sort

@ -19,14 +19,14 @@
class CostlogController < ApplicationController class CostlogController < ApplicationController
menu_item :work_packages menu_item :work_packages
before_filter :find_project, :authorize, only: [:edit, before_action :find_project, :authorize, only: [:edit,
:new, :new,
:create, :create,
:update, :update,
:destroy] :destroy]
before_filter :find_associated_objects, only: [:create, before_action :find_associated_objects, only: [:create,
:update] :update]
before_filter :find_optional_project, only: [:report, before_action :find_optional_project, only: [:report,
:index] :index]
helper :sort helper :sort

@ -24,13 +24,13 @@ class HourlyRatesController < ApplicationController
helper :hourly_rates helper :hourly_rates
include HourlyRatesHelper include HourlyRatesHelper
before_filter :find_user, only: [:show, :edit, :update, :set_rate] before_action :find_user, only: [:show, :edit, :update, :set_rate]
before_filter :find_optional_project, only: [:show, :edit, :update] before_action :find_optional_project, only: [:show, :edit, :update]
before_filter :find_project, only: [:set_rate] before_action :find_project, only: [:set_rate]
# #show, #edit have their own authorization # #show, #edit have their own authorization
before_filter :authorize, except: [:show, :edit, :update] before_action :authorize, except: [:show, :edit, :update]
# TODO: this should be an index # TODO: this should be an index
def show def show

@ -22,7 +22,7 @@ module OpenProject::Costs::Patches::ProjectsControllerPatch
base.send(:include, InstanceMethods) base.send(:include, InstanceMethods)
base.class_eval do base.class_eval do
before_filter :own_total_hours, only: [:show] before_action :own_total_hours, only: [:show]
end end
end end

Loading…
Cancel
Save