Skip to content

Commit

Permalink
Fixes #21734 - Remove alias_method_chain
Browse files Browse the repository at this point in the history
  • Loading branch information
Ondrej Prazak committed Nov 22, 2017
1 parent 55da47a commit acf493e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
6 changes: 2 additions & 4 deletions app/models/foreman_tasks/concerns/action_triggering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ module ActionTriggering
after_create :plan_hook_action
after_update :plan_hook_action
after_destroy :plan_hook_action

alias_method_chain :save, :dynflow_task_wrap
end

# These three *_action methods are called before the save/destroy actually occurs
Expand All @@ -21,8 +19,8 @@ def update_action; end
# @override
def destroy_action; end

def save_with_dynflow_task_wrap(*args)
dynflow_task_wrap(:save) { save_without_dynflow_task_wrap(*args) }
def save(*args)
dynflow_task_wrap(:save) { super(*args) }
end

def save!(*args)
Expand Down
8 changes: 2 additions & 6 deletions lib/foreman_tasks/authorizer_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ module ForemanTasks
module AuthorizerExt
extend ActiveSupport::Concern

included do
alias_method_chain :resource_name, :authorized_resource_name
end

def resource_name_with_authorized_resource_name(klass)
def resource_name(klass)
if klass.respond_to?(:authorized_resource_name)
klass.authorized_resource_name
else
resource_name_without_authorized_resource_name(klass)
super klass
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/foreman_tasks/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class Engine < ::Rails::Engine
config.to_prepare do
ForemanTasks.dynflow.eager_load_actions! if ForemanTasks.dynflow.initialized?

Authorizer.send(:include, AuthorizerExt)
Authorizer.send(:prepend, AuthorizerExt)
end

config.after_initialize do
Expand Down

0 comments on commit acf493e

Please sign in to comment.