Join Kevin Skoglund for an in-depth discussion in this video Embed Ruby, part of Ruby: Files, Formats, Templates.
- [Instructor] In this chapter we're going to learn…how to create template files…that can interact with Ruby code.…And we're going to do that using something called ERB,…which is short for Embedded Ruby.…It's an eRuby templating system…to allow you to embed Ruby code into a template.…An ERB is included with Ruby.…It's in the Ruby Standard Library.…So it's not loaded up by default,…but it's very easy to tell Ruby…to load up that functionality so we can make use of it.…When we want to embed Ruby into a template…there's two ways that we can do that.…
The first is that we can use a less than…and percent sign together to open an ERB tag.…And then we can close that same tag…with a percent sign and a greater than,…and everything in between would be Ruby code,…and that code would be evaluated…when the template is evaluated by ERB.…We can also have these same tags to open and close the code…but also add an equal sign at the beginning,…and that will both evaluate our code…and output the result to the template.…So they work the same way,…
- File system basics
- Writing to and reading from files
- Renaming, deleting, and copying files
- Creating and editing directories
- Working with common data formats
- ERB templating
Skill Level Beginner
Ruby on Rails 5 Essential Trainingwith Kevin Skoglund10h 21m Beginner
1. The File System
2. Work with Files
3. Work with Directories
4. Common Data Formats
5. ERB Templating
- 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.