Topic: rake db:create errors

I am new to Rails like most people under this form and I am having issues with simply creating my database. Its just a simple test database. I understand that it uses sqlite3 by default and I have added the necessary files from the sqlite site to the ruby192\bin folder as I am using Windows Server 2008 R2. However, whenever I attempt to create even the default database I am receiving errors.I have made a directory called sharebox and performed my bundle install. When I attempt to use the command

Re: rake db:create errors

Please, post the error stack trace to see what exactly happens.

Re: rake db:create errors

That is odd, only part of my post appeared. I had posted the code yesterday along with sites I used as a reference.

c:\sharebox>rake db:create
(in c:/sharebox)
rake aborted!
uninitialized constant Rake::DSL
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:6:in `<module:Rake>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:3:in `<top(required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in `require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/test_unit/testing.rake:2:in `require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/test_unit/testing.rake:2:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/test_unit/railtie.rb:12:in `load'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/test_unit/railtie.rb:12:in `block in <class:TestUnitRailtie>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `call'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `block in load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `each'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:396:in `block in load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `each'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `all'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:396:in `load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:103:in `load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
c:/sharebox/Rakefile:7:in `<top (required)>'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `load'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:1991:in `run'
C:/Ruby192/bin/rake:31:in `<main>'

c:\sharebox>

I get errors similar to this even if I attempt to use MySQL5.5 as well. I have made no changes to the config for the database. This is me just trying to build a general default database. 

One of the sites I was using as a reference was:
http://www.prowl.in/sharebox.html

I had two more that were specific to sqlite3 however I don't have them where I am at currently. Again, I had put this in my original post so I am not sure why it didn't come through yesterday. Sorry about that.

Re: rake db:create errors

Could you post the result of the command:

gem env

and all the gems you have installed as follows:

gem list

The second question, - is 'sharebox' is your Rails project ? If so, post its database.yml content too.Thks.

Last edited by Javix (2011-12-17 15:55:48)

Re: rake db:create errors

Below I have the two commands as requested:

c:\sharebox>gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.12
  - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby192/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: C:/Ruby192/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby192/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/Ruby192/lib/ruby/gems/1.9.1
     - C:/Users/pm.admin/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

c:\sharebox>gem list

*** LOCAL GEMS ***

actionmailer (3.1.3)
actionpack (3.1.3)
activemodel (3.1.3)
activerecord (3.1.3)
activeresource (3.1.3)
activesupport (3.1.3)
ansi (1.4.1)
arel (2.2.1)
builder (3.0.0)
bundler (1.0.21)
coffee-rails (3.1.1)
coffee-script (2.2.0)
coffee-script-source (1.1.3)
erubis (2.7.0)
execjs (1.2.12)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.19)
json (1.6.3)
mail (2.3.0)
mime-types (1.17.2)
minitest (1.6.0)
multi_json (1.0.4)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.3)
railties (3.1.3)
rake (0.9.2.2, 0.8.7)
rdoc (3.11, 2.5.8)
sass (3.1.11)
sass-rails (3.1.5)
sprockets (2.0.3)
sqlite3 (1.3.5 x86-mingw32)
sqlite3-ruby (1.3.3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
turn (0.8.2)
tzinfo (0.3.31)
uglifier (1.2.0)

Config\database.yml:
# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

Re: rake db:create errors

A tweet from DHH earlier. Rake .9.0 breaks Rails and several other things, you need to add the following in your Gemfile:

gem "rake", "0.8.7"

and run 'bundle install comand.
Or just add to your Rake file:

module ::YourApplicationName  
  class Application
    include Rake::DSL
  end
end

Re: rake db:create errors

Oh Thank God. Thanks for the help. Now I can finally try to play around with this and maybe actually learn rails.

Re: rake db:create errors

Any one who can guide me to solve the following issue.


http://railsforum.com/viewtopic.php?pid=148192#p148192

Windows XP.