Date and times on forms are complex. Allowing a user to choose a date and time requires generating 5 or 6 select-option tags. Then the values of those select-option tags must be parsed when the form is sent in and also to know which are the currently selected values. Rails has date_select, time_select, and datetime_select helpers which are configurable and take the pain out of the process. Rails also knows how to parse these values when they are submitted or to determine the currently selected values of the options.
- [Instructor] Rails has select-option form helpers…which are specially designed for working…with dates and times.…It can be extremely tedious to take a date and a time,…and to break it up on a form into five…or six different select-option tags.…Then you have to generate the options for each one…of those and then determine which…of those options should be currently selected.…Then once the form has been submitted,…you would need to take all of those parameters…and reassemble them back into a date.…Fortunately, the Rails Helpers make…this process much easier.…We're going to look at the three main Helpers.…
The first of which is date_select.…Date_select works just like select did,…but it will generate three different…select-option tags in a row:…one for year, one for month, and one for day.…We don't have to pass in choices like we did…with the select helper,…because Rails knows what choices to offer.…The choices are going to be dates,…and the helper knows how dates work.…It knows the months of the year,…it knows how many days are in a month.…
- 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?
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.