Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
rake db:migrate not connecting
12 Posts
rake db:migrate not connecting

I am new to RoR and working from tutorials created by Kevin Skoglund. While they are great, they don't focus on the InstantRails app and I am running into problems.

I am currently having an issue with the connecting of the SQLite3 database.yml and the schema.rb.

While it should change the schema.rb when I run the rake command, it does not. Oddly enough, InstantRails, after I created a database, does not automatically associate that database with the application in the database.yml.

What is going on here? Any thoughts?

I just figured it out. I was using the SQLite3 instead of MySQL. All I had to do was this when creating my app: "rails -d mysql :myapp"

If anybody wants to chime in on how to use SQLite3 and the reasons why, it would be helpful to this beginner.

Hi .. pls give a command rails app_name, and then try to change the database to the desired database. Pls make sure that you have created the database, same as the name from the database.yml.

     I will suggest, try to use MYSQL.

Regards Saurabh p http://saurabh.purnaye.googlepages.com


sqlite3 is a simple, fast, single-file, widely-supported database that's particularly suited for use as a development database because it very easy to configure and it's usually significantly faster than more full-blown databases like MySQL. It's nice to use as a test database because its speed enables the large numbers of tests that are typically part of Rails apps to run pretty quickly.

However, sqlite isn't a good solution for most production environments of significantly complex Rails applications. There are a bunch of reasons for this, which you can find pretty easily with a google search.

I've had no problems setting up sqlite with Rails apps--once you have the sqlite3 app and gem installed, it pretty much just works like the other databases that Rails supports, though it's generally a little easier to set up and configure.

The Rails team has become sufficiently enamored of sqlite to switch the default Rails db to it in Rails 2.

Sounds like you might have been using a tutorial with MySQL-oriented configuration instructions and/or admin tools, but a database.yml file that was setting up a sqlite3 database.

Do you have other questions about sqlite3?


Ed and Saurabh,

Thank you for your responses. They were very helpful. Yeah the tutorials I am using are designed for a previous release of rails, so I finding very difficult to move forward. In rails 2.0 there were many changes. Now I am working on trying to get my "scaffold" to work correctly...is there anyway to rollback my rails to the exact version they are using in the tutorial?


I would recommend sticking with Rails 2.0. There are a few major changes that invalidate previous tutorials, but there are 10 times as many transparent bug fixes and improvements that it would be a shame to miss out on.

Gabe, I too would love to stick with it, but having to constantly go back and find solutions to things keeps slowing down how much material I can cover. Any thoughts on "scaffold" being used inside of a controller?

I figured it out: rails -d mysql :myappname cd :myappname {went to phpadmin and created my database} ruby script/generate scaffold :album title:string artist:string release_date:date genre:string rake db:migrate ruby script/server

went to my localhost/albums and it now works...cool

You dont need phpmyadmin

rake db:create:all rake db:drop:all rake db:migrate rake db:rollback

These are a few of my favorite things!

Sr. Ruby & Rails Consultant For Hire
Sign In To Rate Post


The scaffold used by Kevin in his Lynda training tutorials is an outdated and I would even say, a now suggested 'no-no' for Rails. So much so that trying to use that scaffold would probably muddle things up even more for you. However, at the same time, Kevin's work was probably the most helpful for me when I was learning Rails myself. I cannot emphasize enough that you focus on learning RESTful controller practices instead of the previous scaffold idea. In Rails 2, scaffold will now produce a RESTful controller. I would suggest that you hit a big pause on Kevin's tutorials, read up on RESTful controllers in Rails (you might check out Peepcode.com's screencast on REST, and even their starting from scratch with Ruby on Rails parts 1 & 2).

Good luck with learning, and I would suggest that you also check out the Railscast podcasts as they are very good snappy little tutorials that will teach you some good tricks for working with things in Ruby on Rails.

12 Posts
Login to add your message