Soft Limits

Episode #466 by Teacher's Avatar David Kimura

Summary

In this episode, we look at creating soft limits around record creation. Soft limits are a way to programatically limit how many records a user can create. This can be very useful in cases where you have multiple tiered subscription plans and need to provide different limits.
rails model 21:09

Chapters

  • Introduction (0:00)
  • Generating the migrations (2:39)
  • Setting up the associations (4:57)
  • Resource validations (6:16)
  • Updating the link (7:49)
  • Updating the controller (8:51)
  • Creating an update resource mechanism (11:42)
  • Demo and fixing a bug (14:57)
  • Testing from a high plan to a low plan (17:20)
  • Fixing a logic error (18:34)
  • Final thoughts (20:24)
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