Chapter 4 - Working with Controllers Flashcards
1
Q
Action Callbacks
A
Action callbacks enable controllers to run shared pre- and postprocessing code for its actions. These callbacks can be used to do authentication, caching, or auditing before the intended action is performed.
before_action :require_authentication
2
Q
Action Callback Chain Skipping
A
Declaring an action callback on a base class conveniently applies to its subclasses, but sometimes a subclass should skip some of the action callbacks it inherits from a superclass:
skip_before_action :authenticate
3
Q
Action Callback conditions
A
before_action :authorize, only: [: edit, :delete]