Join Kevin Skoglund for an in-depth discussion in this video How to use the exercise files, part of Ruby on Rails 5 Essential Training.
- [Instructor] If you are a premium member of the Lynda.com training library, you will have access to the exercise files that are used throughout this title. The exercise files for this title are arranged by chapter and by movie. And you can find the exercise files that correspond to the movie that you're watching by first looking for the chapter number, and then the movie number. In order to make use of the exercise files, you'll want to first make sure that you have everything installed. That's Ruby, RubyGems, Ruby on Rails, and MySQL. Once everything is installed, then you can copy the folder exercise files into your web directory or another convenient location.
It's always a good idea to make a copy so that you can still have the original to refer back to if you make changes. On my Mac, I'll put them inside my Sites directory, which is inside my User directory. I will Option + Drag the file in order to make a copy. Now your files will be in the same state as mine at the start of the movie. And you'll be able to work right along with me. Don't forget that you can also use the exercise files to check your work as you go along. Beginning in chapter four, we'll be incorporating a database into our project. And for the exercise files to work, your database needs to match what the files expect.
After moving the files to the correct location, making sure that you have a database created, go to your command line and navigate to the root of the Rails application. From there, you can run the command rails otl:import. And it will run an import script which will import the data the code needs and that I'll be using in the movie. Importing can also be useful if you do a lot of experimenting on your own, but then want to get your data back in sync with mine. As you can see, once you run the script, it's gonna provide you some information, it's gonna make sure you have the right database created, and that you've granted privileges to a user.
Once you've done all of that, then you can proceed with the rest of the script. Notice also that it gives you a helpful command here for importing directly into MySQL. This script is just a convenient way to do the same thing. So I'm gonna follow the prompts and I'm gonna proceed by typing yes, and then I can just choose the default settings for everything by hitting Return. I'm going to use the local database, the database is called simple_cms_development. The MySQL user I want to use is called rails_user. The import file path is going to be the file that's in my DB directory, that's where these x ports are stored.
And now it wants me to enter the MySQL password for the user that I chose, Rails user, in this case. Now my import is complete, and both my files and my database are in the correct state. If you are a monthly or annual subscriber to the Lynda.com training library, you won't have the exercise files that accompany this tutorial. But you can follow along with me. Everything that's in the exercise files, we will create during the tutorials. So long as you continue to work along with me, your files will exactly mirror what's in the exercise files. Remember that you can pause the movie, or rewind if you need more time to copy something down.
- 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.