Query methods also allow specifying the sort order of the returned records, the limited number of records that should be retrieved, and the offset or number of records that should be skipped over. Together with conditions, these methods provide a powerful tool for locating exactly the records you need.
- [Instructor] We've seen how to specify…the conditions for our query,…how to retrieve only the records…that match a certain criteria,…but there are three additional query methods…that are helpful in allowing us to find…exactly the records we want, and those are…order, limit, and offset.…Order is going to specify the sort order…of the returned records.…We can sort the records by any column,…ID, name, position, created at, etc.…We can sort them alphabetically, or reverse alphabetically,…ascending, or descending,…chronologically, or reverse chronologically.…
Limit will limit the results that are returned.…This becomes especially important when there are…a lot of records which match our conditions.…Let's imagine that we have a database of 20,000 customers.…We wouldn't want to see a page with…all 20,000 customers at one time,…we'd probably want to view them broken up as pages,…maybe just 20 at a time.…In that case, we would limit the results to 20.…If we then wanted to view page 51 of those results,…we would still want to only get 20 records back,…
- 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.