1 Replies - 1728 Views - Last Post: 15 April 2011 - 11:18 AM Rate Topic: -----

#1 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Could not find gem 'sqlite3 (>= 0)' in any of the gem sour

Posted 13 April 2011 - 06:21 PM

I'm trying to get Ruby installed on my vista laptop. I fail. Here's the error I get when I type "rake db:create:all"

Could not find gem 'sqlite3 (>= 0)' in any of the gem sources listed in your Gemfile.


I followed this guide, but I apparently messed up on one of the steps? Is it the mySQL step? I don't know anything about what's gone wrong, or perhaps a step where I should have set MySQL as the default "thing" instead of sqlite3?

This post has been edited by NotarySojac: 13 April 2011 - 06:23 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Could not find gem 'sqlite3 (>= 0)' in any of the gem sour

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4316
  • View blog
  • Posts: 12,096
  • Joined: 18-April 07

Re: Could not find gem 'sqlite3 (>= 0)' in any of the gem sour

Posted 15 April 2011 - 11:18 AM

First of all if you are wanting to setup rails with MySQL first make sure you install MySQL on your machine and setup a user account for it. Be sure to write down the username and password for this account along with the account name. In MySQL, setup three databases. You can call these library_development, library_test and library_production. Make sure you can access all three with your user account that you setup.

Back in rails, once you have installed MySQL, go into the directories where you installed Rails and look for a file called "database.yml" (typically in C:\ruby\library\config). This is a database configuration file and should have been part of the steps for installing Rails with a MySQL database. In there you will see three groupings of db settings. One for each of the databases you just setup in MySQL.

Modify each of the groups to point to the databases and specify the username and password for accessing each. Here is an example of how these might look...

development:
  adapter: mysql
  database: library_development
  username: root
  password: [password]
  host: localhost
test:
  adapter: mysql
  database: library_test
  username: root
  password: [password]
  host: localhost
production:
  adapter: mysql
  database: library_production
  username: root
  password: [password]
  host: localhost



Save the file and then try to fire up rails again. We can start by creating a migration file to test things out so try something like...

ruby script/generate model Category name:string amount:integer



This should create a "Category" table with the columns "name" and "amount". This will generate our migration file. To commit this to the database we then run the command ...

rake db:migrate



Now go back into MySQL and see if you can see your table. To change the database you apply the migration to, you can specify at the prompt set RAILS_ENV=production replacing production with one of the names of the three we had you setup... library_test, library_production, or library_development.

See how that works for you. :)
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1