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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Action Callback conditions

A

before_action :authorize, only: [: edit, :delete]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly