Learn how to use model objects to find and update records in the database. There are two approaches to updating records: set/save and update_attributes.
- [Instructor] In the last movie,…we learned to create records using Active Record.…In this movie, we're going to learn to update those records.…Like creating records, there are two techniques that we…can use for updating.…One, is where you set the attributes one at a time,…and then save.…And one, where you set the attributes…and save it all at once.…Let's first look at the technique I'll call find save.…First, you find a record,…then you set its values,…and then you save it.…It's very similar to what we had with new save.…The other technique, is using find and update attributes.…
We still have to find the record, but then,…we can set the values and save all in one step.…So it's a two-step process.…Let's try them both.…If you're still in the console after the last movie,…that's fine, there's no need to exit and go back in.…But I'm gonna launch my console again,…and the first step is going to be to find…the record that we want.…I'm going to use subject equals subject dot find one.…This is the simplest way to find a record.…
- Creating and configuring a new Ruby on Rails project
- Generating controllers and views
- Handling server requests
- Using different types of routes
- Rendering and viewing templates
- Generating migrations and models
- Creating, updating, and deleting records
- Finding records with queries
- Understanding relationship types
- Writing controllers for CRUD
- Working with layouts and helpers
- Managing application assets
- Building forms
- Validating data
- Authenticating users
Skill Level Beginner
1. What Is Ruby on Rails?
2. Get Started
3. Controllers, Views, and Dynamic Content
4. Databases and Migrations
5. Models and ActiveRecord
7. CRUD, REST, and Resourceful Routes
8. Controllers and CRUD
9. Layouts, Partials, and View Helpers
12. Data Validation
13. Controller Features
14. User Authentication
15. Improve the Simple CMS
Next steps1m 44s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.