Strict Locals

Episode #388 by Teacher's Avatar David Kimura

Summary

Ruby on Rails 7.1 introduces Required Template Arguments w/ Default Values, or Strict Locals. This solves the issue of difficult to reason about dependencies & runtime compilations. In this episode, we look at how Strict Locals can improve the overall maintainability of our Rails partials.
rails 7.1 view 9:10

Chapters

  • Introduction (0:00)
  • Tutorial begins (1:23)
  • Generating Scaffold (2:07)
  • Enabling annotated views (2:22)
  • Exploring the generated scaffold (3:25)
  • Using strict locals (3:54)
  • Demo strict locals (5:08)
  • Demo of missing a strict local (5:32)
  • Adding locals to partial (5:51)
  • Other ways of rendering partials (6:36)
  • Final thoughts (8:00)
Student & Teacher
$ 9 /mo

Valid School Email Required

Same Access as Pro

Subscribe Now
Pro Monthly
$ 19 /mo

Access to Pro Episodes

Invite to Slack Channel

Priority Suggestions

Ad Free

Subscribe Now
Pro Annual
$ 190 /yr

Access to Pro Episodes

Invite to Slack Channel

Priority Suggestions

Ad Free

Subscribe Now
Teams
$ 57 /mo

3 Users Minimum

$19.00 / user / month

Same Access as Pro

Subscribe to Teams