From the course: Ruby on Rails 6 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using strong parameters to regulate input - Ruby on Rails Tutorial
From the course: Ruby on Rails 6 Essential Training
Using strong parameters to regulate input
- [Instructor] In the last movie, we tried to submit a web form to have it processed by our create action, but we got back an error. That's okay, because the error that we ran into was actually a Rails security feature. That's very useful, but we need to learn how to use it. And to do that, we have to learn about mass assignment and strong parameters. Mass assignment is the term for passing a hash of values, usually from form parameters to an object that's going to be assigned to the object's attributes. New, create, and update are the primary methods that use mass assignment, but there are a few others as well. In each one of these cases, you'll see that we're taking a hash of values, and we're essentially just dumping them into the object and asking the object to assign all of the attributes based on that hash. That's what mass assignment is. Rails is making our lives much easier by allowing us to assign values to this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
Read action: Index4m 20s
-
Read action: Show4m
-
Adding basic forms to templates4m 51s
-
Create action: New4m 12s
-
Create action: Create5m 5s
-
Using strong parameters to regulate input4m 57s
-
Update actions: Edit and update6m 19s
-
Using partials and helpers to organize code6m 36s
-
Delete actions: Delete and destroy5m 50s
-
Challenge: Pages CRUD1m 23s
-
Solution: Pages CRUD4m 50s
-
-