Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Introduction to Ruby on Rails 7!
You have completed Introduction to Ruby on Rails 7!
Preview
Protect your database with Rails validations. Define rules to ensure data integrity, like requiring certain fields or enforcing unique records.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Well, let me click create your own link
tree, and let me delete this tree, and
0:00
then let me create my own link tree again.
0:00
Now, validations are, for example,
let's say I click next, as you can see,
0:02
it says name must be more
than three characters long.
0:07
This is because of the extra JavaScript
that I added, but in this video,
0:10
you're going to learn how to do
validations with Ruby on Rails.
0:14
Specifically, you're going
to go in the model, and
0:17
you're going to learn
how to do validations.
0:20
Essentially, validations stop the tree
model from going into the database
0:22
without meeting certain requirements.
0:26
So, for example, I could have the name
to be over 10 characters long,
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up