Join Kevin Skoglund for an in-depth discussion in this video Solution: Mail merge, part of Ruby: Files, Formats, Templates.
(upbeat music)…- [Instructor] I hope that you were able to come up…with a solution to the mail merge challenge.…In this movie, I'm going to show you the solution…that I came up with step-by-step.…So the first place to start was that I knew…I had this letter_template.txt that I needed…to load in and so I came over to init.rb,…I require ERB and CSV…so I would have those libraries available for me.…I set the template path that I would need.…Letter_template.txt and I knew it would be an app root.…
I went ahead and then did the same thing for CSV path…'cause I knew I would need that file, us_presidents.csv,…so now I have paths to both those files.…So then I call the file read…and I read in the entire template.…Now that's stored inside template.…So that's ready to go.…Alright, step number two was that I needed to parse…the CSV file, so I used CSV for each with the CSV path…and nothing iterates through each line of the CSV file.…Now that first line of the CSV file, you remember,…is a header row and it starts with the word number.…
- 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.