Exercise 3: Closing Chapter 8's Exact Gap — Possible Solution ==================================================================== WHAT before_action :require_admin DOES ------------------------------ Per this chapter, before_action :require_admin registers a callback that runs before the specified Controller action - here, only update_title. Inside require_admin, if session[:admin_user_id] isn't present, the request is redirected to the login page instead of being allowed to reach update_title at all. WHICH GAP FROM CHAPTER 8 IT CLOSES ------------------------------ Per this chapter, Chapter 8 deliberately left update_title with no authentication check at all - not a placeholder value inside an existing method the way Laravel's authorize() was, but a genuinely missing before_action filter, since Rails treats field-permitting (Strong Parameters) and authorization as separate concerns joined by a separate callback. This chapter adds exactly that missing filter, closing the gap in precisely the shape Chapter 8 predicted it would be closed in. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains what before_action :require_admin does and when it runs, and correctly ties it back to Chapter 8's own specific gap - a missing before_action filter, not a placeholder value - rather than describing it as a generic authentication fix.