Ruby on rails初学者

时间:2012-03-01 03:04:18

标签: ruby-on-rails rubygems

我刚接触ruby on rails,正在研究这个简单的应用程序。

我收到此错误:

asad@asad:~$ ruby ./Bookmarker/script/generate scaffold Bookmark
/home/asad/Bookmarker/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection': adapter:mysql2 database:bookmarker host:localhost username:root password:*** database is not configured (ActiveRecord::AdapterNotSpecified)
from /home/asad/Bookmarker/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:58:in `establish_connection'
from /home/asad/Bookmarker/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:53:in `establish_connection'
from ./Bookmarker/script/../config/../vendor/rails/railties/lib/initializer.rb:392:in `initialize_database'
from ./Bookmarker/script/../config/../vendor/rails/railties/lib/initializer.rb:139:in `process'
from ./Bookmarker/script/../config/../vendor/rails/railties/lib/initializer.rb:112:in `send'
from ./Bookmarker/script/../config/../vendor/rails/railties/lib/initializer.rb:112:in `run'
from /home/asad/Bookmarker/config/environment.rb:13
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /home/asad/Bookmarker/vendor/rails/railties/lib/commands/generate.rb:1
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ./Bookmarker/script/generate:3

以下是:

的输出
asad@asad:~$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.5
- RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
- RUBYGEMS PLATFORMS:
  - ruby
  - x86-linux
- GEM PATHS:
   - /var/lib/gems/1.8
   - /home/asad/.gem/ruby/1.8
- GEM CONFIGURATION:
   - :update_sources => true
   - :verbose => true
   - :benchmark => false
   - :backtrace => false
   - :bulk_threshold => 1000
- REMOTE SOURCES:
   - http://gems.rubyforge.org/

我的database.yml是

development:
   adapter:mysql2
   database:bookmarker
   host:localhost
   username:root
   password:****

对此有任何意见,都会有很大的帮助。感谢。

1 个答案:

答案 0 :(得分:2)

您需要先rake db:create初始化数据库。