Developers are not limited to the helper methods built-in to Ruby on Rails. It is possible to write custom view helpers. Learn how to add a helper method called “status_tag” which will display a red or green box whenever a Boolean value is true or false.
- [Voiceover] Throughout this chapter, we've been looking…at helper methods which Rails provides to make common…tasks in our view templates easier. But we aren't…limited only to the built in helpers. We can add our own…custom helpers as well. That's what we're going to learn…to do in this movie. Helper methods are going to be…defined inside Ruby modules. You may have noticed that…whenever we generate a controller, Rails generates…a placeholder helper file that matches. There's nothing…magic about that file it generates. You can write…your own helpers too. The only important thing is that…the file name and the helper's module name need to match.…
Any helper methods that are defined in that file…will be available for use in our view templates.…Custom Helpers are useful for a couple of different things.…They are a good place to store code that we're going to…need to call often. They're good for putting complex…sections of code that we don't want cluttering up…our view templates. And helpers are a good place to…
- 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.