Rails 4: before_filter vs. before_action

freemanoid picture freemanoid · May 13, 2013 · Viewed 159.4k times · Source

In rails >4.0.0 generators creates CRUD operations with before_action not before_filter. It seems to do the same thing. So what's the difference between these two?

Answer

freemanoid picture freemanoid · May 13, 2013

As we can see in ActionController::Base, before_action is just a new syntax for before_filter.

However all before_filters syntax are deprecated in Rails 5.0 and will be removed in Rails 5.1