1
+ require 'active_support/deprecation'
2
+
1
3
module AbstractController
2
4
module Callbacks
3
5
extend ActiveSupport ::Concern
@@ -65,7 +67,11 @@ def skip_action_callback(*names)
65
67
skip_after_action ( *names )
66
68
skip_around_action ( *names )
67
69
end
68
- alias_method :skip_filter , :skip_action_callback
70
+
71
+ def skip_filter ( *names )
72
+ ActiveSupport ::Deprecation . warn ( "#{ callback } _filter is deprecated and will removed in Rails 5.1. Use #{ callback } _action instead." )
73
+ skip_action_callback ( *names )
74
+ end
69
75
70
76
# Take callback names and an optional callback proc, normalize them,
71
77
# then call the block with each callback. This allows us to abstract
@@ -180,14 +186,22 @@ def _insert_callbacks(callbacks, block = nil)
180
186
set_callback ( :process_action , callback , name , options )
181
187
end
182
188
end
183
- alias_method :"#{ callback } _filter" , :"#{ callback } _action"
189
+
190
+ define_method "#{ callback } _filter" do |*names , &blk |
191
+ ActiveSupport ::Deprecation . warn ( "#{ callback } _filter is deprecated and will removed in Rails 5.1. Use #{ callback } _action instead." )
192
+ send ( "#{ callback } _action" , *names , &blk )
193
+ end
184
194
185
195
define_method "prepend_#{ callback } _action" do |*names , &blk |
186
196
_insert_callbacks ( names , blk ) do |name , options |
187
197
set_callback ( :process_action , callback , name , options . merge ( :prepend => true ) )
188
198
end
189
199
end
190
- alias_method :"prepend_#{ callback } _filter" , :"prepend_#{ callback } _action"
200
+
201
+ define_method "prepend_#{ callback } _filter" do |*names , &blk |
202
+ ActiveSupport ::Deprecation . warn ( "prepend_#{ callback } _filter is deprecated and will removed in Rails 5.1. Use prepend_#{ callback } _action instead." )
203
+ send ( "prepend_#{ callback } _action" , *names , &blk )
204
+ end
191
205
192
206
# Skip a before, after or around callback. See _insert_callbacks
193
207
# for details on the allowed parameters.
@@ -196,11 +210,19 @@ def _insert_callbacks(callbacks, block = nil)
196
210
skip_callback ( :process_action , callback , name , options )
197
211
end
198
212
end
199
- alias_method :"skip_#{ callback } _filter" , :"skip_#{ callback } _action"
213
+
214
+ define_method "skip_#{ callback } _filter" do |*names , &blk |
215
+ ActiveSupport ::Deprecation . warn ( "skip_#{ callback } _filter is deprecated and will removed in Rails 5.1. Use skip_#{ callback } _action instead." )
216
+ send ( "skip_#{ callback } _action" , *names , &blk )
217
+ end
200
218
201
219
# *_action is the same as append_*_action
202
220
alias_method :"append_#{ callback } _action" , :"#{ callback } _action"
203
- alias_method :"append_#{ callback } _filter" , :"#{ callback } _action"
221
+
222
+ define_method "append_#{ callback } _filter" do |*names , &blk |
223
+ ActiveSupport ::Deprecation . warn ( "append_#{ callback } _filter is deprecated and will removed in Rails 5.1. Use append_#{ callback } _action instead." )
224
+ send ( "append_#{ callback } _action" , *names , &blk )
225
+ end
204
226
end
205
227
end
206
228
end
0 commit comments