File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -1157,19 +1157,19 @@ class ApplicationController < ActionController::Base
1157
1157
end
1158
1158
1159
1159
class ActionDurationCallback
1160
- def self.around(controller, action )
1160
+ def self.around(controller)
1161
1161
start_time = Time.now
1162
- yield # This executes the action
1162
+ yield # This executes the action
1163
1163
end_time = Time.now
1164
1164
1165
1165
duration = end_time - start_time
1166
- Rails.logger.info "Action #{action } from controller #{controller} took #{duration.round(2)} seconds to execute."
1166
+ Rails.logger.info "Action #{controller.action_name } from controller #{controller.controller_name } took #{duration.round(2)} seconds to execute."
1167
1167
end
1168
1168
end
1169
1169
` ` `
1170
1170
1171
1171
In above example, the `ActionDurationCallback`'s method is not run in the scope
1172
- of the controller but gets `controller` and `action` as an argument.
1172
+ of the controller but gets `controller` as an argument.
1173
1173
1174
1174
In general, the class being used for a `*_action` callback must implement a
1175
1175
method with the same name as the action callback. So for the `before_action`
You can’t perform that action at this time.
0 commit comments