Discover how to create HTML forms which submit form values as a single parameter containing an array of values. Sinatra will make parameter arrays available as Ruby arrays which makes it easier to work with a collection of values.
- [Instructor] In this movie, I want to show you a technique…that can help you when working with forms.…It can help you to better organize your parameters…so that you can work with them inside your Ruby code.…First, let's begin by looking at a basic form.…So here's a simple form, you see its action…is going to go to /user/new.…It's method is post.…It's going to be a post request.…And you can see I've got four inputs.…All of them are text inputs and the names of these inputs…are first_name, last_name, username, and email.…That's going to be the parameter name that gets submitted…along with whatever value the user gives us.…
So, when we get into our route and we have our block of code…we can then address each of those values by its name…inside the params.…So the post parameters will be available to us inside params…If you want to get first name, we ask for params…and then first name and so on, all the way down.…Now there is nothing wrong with doing it that way.…You absolutely can.…Feel free to.…But I want to show you an alternative.…
- Installing Sinatra
- Launching the server
- Defining routes
- Using route patterns and parameters
- Redirecting requests
- Rendering dynamic templates
- Using partial templates and layouts
- Defining custom helpers
Skill Level Intermediate
Ruby on Rails 5 Essential Trainingwith Kevin Skoglund10h 21m Beginner
Ruby on Rails: Get More From ActiveRecordwith Kevin Skoglund4h 27m Intermediate
3. Helpers and Filters
4. Useful Techniques
- 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.