Join Kevin Skoglund for an in-depth discussion in this video Using the exercise files, part of Ruby on Rails 3 Essential Training.
If you're watching this tutorial, then you will have access to the Exercise Files that are used throughout this title. The Exercise Files, with the titles, are arranged by chapter and by movie. And to find the Exercise Files that correspond to the movie that you are watching, you will first want to look for the chapter number, followed by the movie number. Of course, in order to use the Exercise Files, you'll want to first make sure that you have the software installed, as shown in Chapters 2 and 3, that is Ruby, RubyGems, Ruby on Rails, and MySQL. Once you are confident you have everything installed, then you'll want to copy the Exercise Files into you web directory or into another convenient location.
It's always a good idea to make a copy so that you'll still have that original to refer back to if you make changes. On my Mac, I am going to put that inside my Sites directory, which is inside my user folder. So I will open up Sites, and then I will drag over 09_03. That's going to be for Chapter 9, movie 3. I'll hold down the Option key while I drag, to make a copy of that, and then you'll want to rename the file by removing the chapter number and the movie number at the beginning. And now your files will be the same as mine at the start of the movie and you'll be able to work right along with me.
And don't forget, you can also use the Exercise Files to check your work as you go along. Beginning in Chapter 6, we'll also 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 their correct location and making sure that you have a database created, open up your command line and navigate to the root of your Rails directory. For me, that's going to be cd Sites/simple_cms. So that's my Rails route, and from here you can run a script that I provided for you called rake otl:import.
And this script will import the data that the code needs and that I will be using in the movie. Let me just show you real quick. So I hit Return. It gives you some instructions here about how to create a database and some helpful hints, and it also notes that if for any reason you have problems with the script, this is the MySQL that it's actually executing, and you can try that directly from the command line. It will remove any existing data. Do we proceed? We'll say yes, and then we can choose the different settings. Hitting Return will just select the default in every case. So if you want something different, you can choose that; otherwise the default, which is what we will use in the training, is what you will enter.
And then we will need to enter the password that we have set up for the user, simple cms, and for me in the training, I use just secret password. And now it says Import complete. Now your database has imported the file that's at db/simple_cms_development.sql, and your database will be in the same state as mine. Remember, that you can pause the video or rewind if you need more time to copy something down.
- Understanding MVC (Model View Controller ) architecture
- Routing browser requests through the framework
- Responding to requests with dynamic content
- Defining associations and database relationships
- Creating, reading, updating and deleting records
- Working with forms
- Validating form data
- Reviewing built-in security features
- Authenticating users and managing user access
- Debugging and error handling
Skill Level Beginner
1. What Is Ruby on Rails?
2. Installing Ruby on Rails on a Mac
3. Installing Ruby on Rails on a Windows Machine
4. Getting Started
5. Controllers, Views, and Dynamic Content
6. Databases and Migrations
7. Models, ActiveRecord, and ActiveRelation
9. Controllers and CRUD
10. Layouts, Partials, and View Helpers
12. Data Validation
13. User Authentication
14. Improving the Simple CMS
15. Debugging and Error Handling
16. Introducing More Advanced Topics
- 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.