navigate site menu

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

Ruby on Rails 3 Essential Training
Richard Downs

Ruby on Rails 3 Essential Training

with Kevin Skoglund

 


In Ruby on Rails 3 Essential Training, instructor Kevin Skoglund shows how to create full-featured, object-oriented web applications with the latest version of 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

show more

author
Kevin Skoglund
subject
Developer, Web, Servers, Programming Languages, Web Development
software
Ruby on Rails 3
level
Beginner
duration
12h 9m
released
Oct 21, 2010

Share this course

Ready to join? get started


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Frequently asked questions

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




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.

Can’t find an answer?

If you still have a question about Ruby on Rails 3 Essential Training, let us know.

ask a question

Suggested courses to watch next:

Ruby Essential Training (6h 54m)
Kevin Skoglund

Ruby on Rails Beyond the Basics (2007) (11h 36m)
Kevin Skoglund


Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 104,069 instructional videos.

get started learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 2,024 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.

preview image of new course page

Try our new course pages

Explore our redesigned course pages, and tell us about your experience.

If you want to switch back to the old view, change your site preferences from the my account menu.

Try the new pages No, thanks

site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

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.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

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

   
submit Lightbox submit clicked