Start learning with our library of video tutorials taught by experts. Get started

Ruby on Rails 3 Essential Training
Illustration by Richard Downs

Ruby on Rails 3 Essential Training

with Kevin Skoglund

Video: Welcome

Welcome to Ruby on Rails Essential Training. My name is Kevin Skoglund. I run a web developing company called Nova Fabrica, where we develop applications and web sites using Ruby on Rails. In this course, we are going to learn Ruby on Rails, the popular open source web development framework. We will learn how to use Ruby on Rails to interact with the database and manage our database schema. We will learn how to handle browser requests and control the resulting actions. I will walk you through the steps to develop templates to create, read, update, and delete database records, and we'll discover how to work with relational database associations effectively.
Expand all | Collapse all
  1. 3m 50s
    1. Welcome
      57s
    2. Using the exercise files
      2m 53s
  2. 11m 52s
    1. What is Ruby on Rails?
      2m 32s
    2. Why use Ruby on Rails?
      5m 44s
    3. Understanding MVC architecture
      3m 36s
  3. 58m 3s
    1. Terminal and Unix setup
      10m 18s
    2. Xcode (Updated)
      4m 6s
    3. Homebrew
      4m 0s
    4. Ruby
      10m 2s
    5. RubyGems
      3m 39s
    6. Rails
      5m 49s
    7. MySQL
      10m 50s
    8. Web server
      3m 2s
    9. Text editor
      6m 17s
  4. 42m 16s
    1. Using the Command Prompt
      3m 5s
    2. Ruby
      5m 35s
    3. RubyGems
      2m 29s
    4. Rails
      1m 56s
    5. MySQL
      13m 30s
    6. MySQL DLL fix
      7m 44s
    7. Web server
      2m 3s
    8. Text editor
      5m 54s
  5. 40m 17s
    1. Creating a project
      5m 15s
    2. Accessing a project
      6m 6s
    3. Generating a controller and view
      7m 10s
    4. File structure of a Rails application
      6m 30s
    5. How server requests are handled
      7m 57s
    6. Routes
      7m 19s
  6. 37m 39s
    1. Rendering templates
      7m 12s
    2. Redirecting actions
      6m 2s
    3. View templates
      5m 37s
    4. Instance variables
      4m 13s
    5. Links
      5m 27s
    6. URL parameters
      9m 8s
  7. 1h 12m
    1. Introducing databases
      7m 3s
    2. Creating a database
      6m 8s
    3. Configuring a project for a database
      5m 49s
    4. Rake
      4m 43s
    5. Introducing migrations
      3m 51s
    6. Generating a migration
      10m 30s
    7. Running a migration
      9m 53s
    8. Migration methods
      9m 0s
    9. Solving migration problems
      4m 59s
    10. Migrations for the CMS
      3m 46s
    11. Migration exercise solution
      7m 2s
  8. 1h 0m
    1. Understanding ActiveRecord and ActiveRelation
      5m 13s
    2. Generating a model
      6m 49s
    3. Working in the Rails console
      2m 35s
    4. Creating records
      6m 31s
    5. Updating records
      4m 1s
    6. Deleting records
      2m 2s
    7. Finding records
      7m 54s
    8. Query methods: Conditions
      12m 15s
    9. Query methods: Order, limit, and offset
      6m 31s
    10. Named scopes
      6m 14s
  9. 45m 21s
    1. Relationship types
      5m 31s
    2. One-to-one associations
      7m 17s
    3. One-to-many associations
      7m 49s
    4. Many-to-many associations: Simple
      8m 13s
    5. Many-to-many associations: Rich
      10m 35s
    6. Traversing a rich association
      5m 56s
  10. 47m 34s
    1. Basic CRUD
      4m 37s
    2. Read action: List
      5m 54s
    3. Read action: Show
      6m 5s
    4. Form basics
      6m 34s
    5. Create action: New
      3m 24s
    6. Create action: Create
      4m 27s
    7. Update actions: Edit/update
      4m 59s
    8. Delete actions: Delete/destroy
      5m 54s
    9. Flash hash
      5m 40s
  11. 57m 4s
    1. Layouts
      7m 16s
    2. Partial templates
      5m 1s
    3. Stylesheets
      7m 14s
    4. JavaScript
      6m 52s
    5. Images
      3m 12s
    6. Text helpers
      9m 7s
    7. Number helpers
      3m 15s
    8. Date and time helpers
      8m 5s
    9. Custom helpers
      7m 2s
  12. 1h 0m
    1. Form helpers
      8m 42s
    2. Form option helpers
      6m 3s
    3. Date and time form helpers
      6m 59s
    4. Form tag helpers
      7m 46s
    5. Form errors
      8m 2s
    6. Form field labels
      3m 56s
    7. Preventing cross-site request forgery
      4m 53s
    8. Escaping input
      3m 21s
    9. Escaping output
      10m 27s
  13. 31m 3s
    1. Validation methods
      8m 39s
    2. Using validation methods
      13m 49s
    3. Validates method
      3m 20s
    4. Validating associated records
      5m 15s
  14. 1h 2m
    1. Introduction to authentication
      3m 26s
    2. Hashing passwords
      6m 36s
    3. Salting passwords
      7m 12s
    4. Protecting attributes during mass assignment
      7m 0s
    5. Callbacks
      9m 1s
    6. Authenticating
      3m 35s
    7. Login and logout
      7m 7s
    8. Cookies and sessions
      11m 30s
    9. Restricting access: Before filters
      7m 15s
  15. 59m 40s
    1. Admin user CRUD
      10m 41s
    2. Nesting pages in subjects
      10m 10s
    3. Scoping the sort positions
      4m 44s
    4. Managing sort positions
      9m 59s
    5. Using the positionMove module
      9m 51s
    6. Public area
      7m 59s
    7. Public area navigation
      6m 16s
  16. 24m 12s
    1. Errors in the development environment
      9m 19s
    2. Logging to log files
      9m 1s
    3. Debugging techniques
      2m 40s
    4. Errors in the production environment
      3m 12s
  17. 31m 4s
    1. Deploying
      7m 32s
    2. Adding libraries, gems, and plug-ins
      4m 32s
    3. Bundler
      3m 50s
    4. REST
      8m 12s
    5. Testing
      6m 58s
  18. 2m 8s
    1. Goodbye
      2m 8s

Watch this entire course now —plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
Watch the Online Video Course Ruby on Rails 3 Essential Training
12h 27m Beginner Oct 21, 2010 Updated Aug 12, 2013

Viewers: in countries Watching now:

In Ruby on Rails 3 Essential Training, instructor Kevin Skoglund shows how to create full-featured, object-oriented web applications with the popular, open-source Ruby on Rails framework. This course explains the complete process—from the fundamental concepts and best practices behind the Rails framework, to how to build a complete application with dynamic, database-driven content. Using a content management system as an example project, this course explains how to structure databases, build database-driven, object-oriented models, route incoming requests, render pages with dynamic content, and to process and validate form data. Previous experience with Ruby is recommended, but not required. Exercise files accompany the course.

Topics include:
  • 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
Subjects:
Developer Web Servers Programming Languages Web Development
Software:
Ruby on Rails
Author:
Kevin Skoglund

Welcome

Welcome to Ruby on Rails Essential Training. My name is Kevin Skoglund. I run a web developing company called Nova Fabrica, where we develop applications and web sites using Ruby on Rails. In this course, we are going to learn Ruby on Rails, the popular open source web development framework. We will learn how to use Ruby on Rails to interact with the database and manage our database schema. We will learn how to handle browser requests and control the resulting actions. I will walk you through the steps to develop templates to create, read, update, and delete database records, and we'll discover how to work with relational database associations effectively.

Finally, you will gain practical hands- on experience by building a complete Ruby on Rails application, a simple content management system. Now, it doesn't matter if you are a complete beginner or if you have some prior experience. We'll cover all the fundamentals you need to begin creating rich web applications that can leverage the power of relational databases. So let's get started learning Ruby on Rails.

Find answers to the most frequently asked questions about Ruby on Rails 3 Essential Training .


Expand all | Collapse all
please wait ...
Q: When running the AlterUsers migration as described in the "Migration methods" video, I am getting "rake aborted!" with an "Invalid Date: BTREE" error. What could be causing this error?
A: add_index is causing the problem. There appears to be in a bug in either the MySQL2 gem or in the MySQL lib file. Some users have reported that using the libmysql.dll file from MySQL 5.1 (32-bit) will fix the problem. The simplest fix is to comment out that line in the migration. Your code will still work; not having an index on the column will just slow down some database lookups.
Q: When I try to open up the server (WEBrick) by typing "rails server", as shown in the movie "Accessing a project", I receive the following error:

Gem::Specification#default_executable= called from /Library/Ruby/Gems/1.8/specifications/rubygems-update-1.8.3.gemspec:11./Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
The installation problem on Mac OS X Snow Leopard is likely caused by a bug in the mysql2 gem that appeared when MySQL 5.5 came out. Hopefully newer versions of MySQL or the mysql2 gem will fix them problem. Until then, a detailed solution to the problem can be found at http://freddyandersen.wordpress.com/2010/10/03/mysql-5-5-snow-leopard-and-rails.
Q: While performing the steps outlined in the "Migration methods" video, I'm receiving an error. The rake db:migrate works fine, but rake db:migrate VERSION=0 results in the following error:
 
rake aborted!
An error has occurred, all later migrations canceled:

Index name 'index_admin_users_on_username' on table 'admin_users' does not exist.
A: To isolate the error, comment out that line and any others that are resulting in errors. Then try again. Once you get to VERSION 0, then uncomment them again.
 
This is also explained in the movie "Solving migration problems" later in the chapter.
Q: I'm OS X 10.6.7 and there's a problem with RubyGems 1.8.1 and the database won't start. Should I somehow delete RubyGems and use and earlier version? How doing I get out of this pickle and start again to complete the course? The error message in Terminal reads:

NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Library/Ruby/Gems/1.8/specifications/rubygems-update-1.8.1.gemspec:11.
 
user$ pwd
/Users/user/Sites/simple_cms
user$ rails server
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Library/Ruby/Gems/1.8/specifications/rubygems-update-1.8.1.gemspec:11.
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Library/Ruby/Gems/1.8/specifications/rubygems-update-1.8.1.gemspec:11.
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
A: The first section, with "default_executable= is deprecated", is just a bunch of annoying warning messages. A lot of people in the Rails community are annoyed about it.

First try: gem pristine --all --no-extensions

If that doesn't fix it, then you can go back to the less-noisy version of RubyGems until all those other gems get updated to remove the code causing the warnings, using: sudo gem update --system 1.7.2

The second part is the actual error:
 
dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info

This is usually because you installed the wrong version of MySQL (32-bit vs. 64-bit).
Q: I'm trying to create a new subject, as shown in the Chapter 7 movie "Creating new records." I encounter a problem when I input:

this subject = Subject.new9:name => "Forth Subject", :visible => true)

I get the error message ActiveModel::MassAssignmentSecurity::Error: Can't mass-assign
protected attributes. What is the issue here?
A: Starting with Rails 3.2.3, released just this week, mass assignment security is turned on by default. (See http://weblog.rubyonrails.org/2012/3/30/ann-rails-3-2-3-has-been-released/ and http://guides.rubyonrails.org/security.html#mass-assignment for more information.)

You can deal with this change in one of two ways:

1. Turn off the security setting. Open config/application.rb and change config.active_record.whitelist_attributes to false instead of true. This makes your app a little less secure, but allows you to quickly move forward with the tutorial.

2. Work with the security settings. The proper technique is to go into each model (like Subject) and add attr_accessible for each field that a web form should be able to mass assign a value to. For example:

class Subject < ActiveRecord::Base

attr_accessible :name, :visible

end
Q: When trying to create or connect to a database, I'm getting a "cannot login to localhost" error message. What's the solution?
A:  As mentioned in the Chapter 4 "Accessing a project" video, localhost is an alias for the 127.0.0.1 ip address. If you have any problems connecting to localhost, default to using the IP address instead. Assign the host value in the database.yml file to the ip 127.0.0.1 instead of localhost.
Q: This course was updated on 8/12/2013. What changed?
A: We updated 12 movies to reflect changes to Ruby on Rails, as of version 3.2, and to accommodate the release of version 4.0. This includes updates to the Macintosh installation process, how you access a new project, loading stylesheets, and making model attributes accessible for mass assignment.
 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

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.


Mark all as unwatched Cancel

Congratulations

You have completed Ruby on Rails 3 Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.