Join Kevin Skoglund for an in-depth discussion in this video Solution: Multi-list maker, part of Ruby: Files, Formats, Templates.
(upbeat music)…- [Instructor] I hope that you were able to complete…the challenge assignment for the multi-list maker.…In this movie, I'm going to show you the solution…that I came up with.…Now you shouldn't have needed to make any changes…to init.rb, controller.rb, or list.rb.…I had done all of that work for you already.…List_dir.rb though is where…you needed to fill in some blanks.…And let's start with that initialize method.…So the first step is to check and see…if the directory exists, and if it doesn't,…then to create it.…
If it does exist, we want to make sure…it's readable and writeable.…So it works very similar to what we were doing…in list_file.rb, you could use that as a template…for a lot of it, go down the list,…and then just change a few things.…So we're going to set the directory path…by using the file join with APP_ROOT…and the directory name, we got that from up here, dirname.…And then I'm going to check and see,…dir.exist to see if it exists.…If it does exist, I'm going to check and see…if it's readable and writeable.…
- 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.