_filter vs _action
This brief post will explain the difference between *_action functions and *_filter functions.
Published on:July 18, 2014
If you are coming to Rails 4 from earlier versions of Rails, you may have noticed the new
_action methods floating around. Seeing these for the first time may have left you scratching your head a bit and asking "aren't these the same as the
_filter functions in previous versions of Rails?" The answer is a resounding YES. For Rails 4.x, the rails team decided to rename the functions to better describe what they are doing. Don't worry, the old functions still work. However it is recommended that you use the new syntax going forward, as the
_filter functions may be deprecated in the future. Below shows a list of the old and new functions.
|Old Function||New Function|
That's it, thanks for reading!