Action callbacks in controllers have been renamed from
For example:
end
The old
*_filter
to *_action
.For example:
class
UsersController < ApplicationController
before_action
:set_user
,
:except
=> [
:index
,
:new
,
:create
}
before_action
:require_the_president
,
:only
=> [
:fire_the_missiles
]
private
def
set_user
@user
= somehow_find_and_set_the_user(params[
:id
])
end
def
require_the_president
@user
.is_the_president?
end
The old
*_filter
callbacks still work and are not deprecated; so, you can still use them if you wish.