Learn to implement basic “update” and “edit” actions by writing controller code and the related HTML for the view templates. The update action is a Read operation that displays an HTML form for preparing to update a database record. The edit action is an Update operation that updates a single existing record in the database with new values.
- View Offline
- Exercise Files
- [Instructor] We've added code which will…create records from our controller.…Now, we want to be able to…update existing records from the controller.…Like create, there are two…standard Rails actions for updating.…Edit displays the form, while update processes the form.…In fact, this two-step process of updating records…is almost exactly like the process…we just saw for creating them.…There are only two key differences.…The first is that we need to make sure that we have an ID.…New and create didn't need an ID,…because there was no record in the database yet,…but edit and update require there be an ID…so we can find that existing record.…
Once edit retrieves that existing record,…it will use its values to pre-populate the form.…Update will also need to find the object…before it can update it.…The second difference is going to be in the form processing.…Create instantiated a new object, and then saved it.…Update is going to find an existing object,…and then use update attributes in order to update its data,…but otherwise, the two processes are almost identical.…
- 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
MVC Frameworks for Building PHP Web Applicationswith Drew Falkman2h 39m Intermediate
Up and Running with Python and Djangowith Caleb Smith1h 11m Intermediate
RSpec Testing Framework with Rubywith Kevin Skoglund6h 13m Intermediate
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.