views:

28

answers:

1

Hello,

I just installed a fresh new version of Ubuntu 10.04 and wanted to get my rails projects working. I checked out a rails project 2.3.3 and fill in the databasye.yml file with the typical sqlite-settings:

# SQLite version 3.x
#   gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
  adapter: sqlite3
  database: db/pictrs_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/pictrs_test.sqlite3
  pool: 5
  timeout: 5000

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

When I run:

rake db:create

I get the following error:

helex@mg:~/Downloads/pictrs_on_rails$ rake db:migrate
(in /home/helex/Downloads/pictrs_on_rails)
rake aborted!
no such file to load -- initializer
/home/helex/Downloads/pictrs_on_rails/Rakefile:4:in `require'
(See full trace by running task with --trace)

The output of rake db:create --trace is:

rake aborted!
no such file to load -- initializer
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/home/helex/Downloads/pictrs_on_rails/config/boot.rb:55:in `load_initializer'
/home/helex/Downloads/pictrs_on_rails/config/boot.rb:38:in `run'
/home/helex/Downloads/pictrs_on_rails/config/boot.rb:11:in `boot!'
/home/helex/Downloads/pictrs_on_rails/config/boot.rb:110
/home/helex/Downloads/pictrs_on_rails/Rakefile:4:in `require'
/home/helex/Downloads/pictrs_on_rails/Rakefile:4
/usr/lib/ruby/1.8/rake.rb:2383:in `load'
/usr/lib/ruby/1.8/rake.rb:2383:in `raw_load_rakefile'
/usr/lib/ruby/1.8/rake.rb:2017:in `load_rakefile'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:2016:in `load_rakefile'
/usr/lib/ruby/1.8/rake.rb:2000:in `run'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1998:in `run'
/usr/bin/rake:28

rake seems to have problems with loading the following line of the Rakefile:

require(File.join(File.dirname(__FILE__), 'config', 'boot'))

I set up the same project under ubuntu 9.10 and I got error-messages when doing a rake task which told me to install specific gems for the project and so this was easy to fix. I create other fresh projects and they all worked. Actually I don't know where to look for the error. I used different rubygems versions and tryed various things out of my google-search.

Here my gem-list:

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.0)
actionpack (3.0.0)
activemodel (3.0.0)
activerecord (3.0.0)
activeresource (3.0.0)
activesupport (3.0.0)
arel (1.0.1)
authlogic (2.1.6)
aws-s3 (0.6.2)
barby (0.4.0)
builder (2.1.2)
bundler (1.0.0)
columnize (0.3.1)
configuration (1.1.0)
daemons (1.1.0)
erubis (2.6.6)
fastthread (1.0.7)
gravatar (1.0)
haml (3.0.18)
heroku (1.10.0)
i18n (0.4.1)
json_pure (1.4.6)
launchy (0.3.7)
libxml-ruby (1.1.4)
linecache (0.43)
log4r (1.1.8)
macaddr (1.0.0)
mail (2.2.5)
memcache-client (1.8.5)
mime-types (1.16)
money (3.0.5)
mysql (2.8.1)
pg (0.9.0)
polyglot (0.3.1)
prawn (0.8.4)
prawn-core (0.8.4)
prawn-layout (0.8.4)
prawn-security (0.8.4)
prawnto (0.0.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.4)
rails (3.0.0)
railties (3.0.0)
rake (0.8.7)
rest-client (1.6.1, 1.4.2)
rmagick (2.13.1)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
ruby-debug-ide (0.4.10)
rubygems-update (1.3.7)
rubyzip (0.9.4)
sqlite3-ruby (1.3.1)
stateless-systems-paypal (2.1.3)
SystemTimer (1.2)
test-unit (2.1.1)
text-format (1.0.0)
text-hyphen (1.0.0)
thor (0.14.0)
treetop (1.4.8)
tzinfo (0.3.23)
uuid (2.3.1)
xml-simple (1.0.12)
ya2yaml (0.30)

I have installed, in my opinio all needed gems. Can you just give some new things to think about how to fix this issue?

Thanks a lot for your time.

+1  A: 

You have Rails 3.0 installed, but you're trying to run a Rails 2.3.3 project. Try installing a Rails version that matches your project and you'll probably be fine.

Pär Wieslander
Hello, I successfully installed rails 2.3.3 and it is now shown im my gem list. If I now want to run "rake db:create" a I get the following response: "rake aborted!can't activate rails (= 2.3.3, runtime) for [], already activated rails-3.0.0 for []". How can I set the rails version for this project only? Maybe a symbolic link or something familiar?
Matthias Guenther
Try putting `RAILS_GEM_VERSION = '2.3.3'` at the top of `config/environment.rb`.
Pär Wieslander
That works perfect, I have now learned how to handle different rails-versions.
Matthias Guenther