Rake db:schema:dump,如何创建schema.rb

时间:2014-02-11 03:02:32

标签: ruby-on-rails ruby rake

对于我不熟悉Ruby的问题。

我在我的命令行中尝试了下面的代码,将我的mysql数据库连接到我的项目,但我还没有将它们连接起来。我已经看过可用的问题,但没有一个对我的案例有效。

rake aborted!
no implicit conversion of String into Hash
/Users/anirudhmaheshwari/Sites/simple_cms2/config/routes.rb:3:in `block in <top (required)>'
/Users/anirudhmaheshwari/Sites/simple_cms2/config/routes.rb:1:in `<top (required)>'
/Users/anirudhmaheshwari/Sites/simple_cms2/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:schema:dump => environment
(See full trace by running task with --trace)

我的database.yml文件的相关部分

development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: simple_cms_development
  pool: 5
  username: simple_cms
  password: [FILTERED]
  socket: /tmp/mysql.sock

完整的痕迹:

/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:254:in `merge'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:254:in `root'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1321:in `root'
/Users/anirudhmaheshwari/Sites/simple_cms2/config/routes.rb:3:in `block in <top (required)>'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in `instance_exec'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in `eval_block'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:267:in `draw'
/Users/anirudhmaheshwari/Sites/simple_cms2/config/routes.rb:1:in `<top (required)>'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `each'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:16:in `reload!'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:26:in `block in updater'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/active_support/file_update_checker.rb:78:in `call'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/active_support/file_update_checker.rb:78:in `execute'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:27:in `updater'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/anirudhmaheshwari/Sites/simple_cms2/config/environment.rb:5:in `<top (required)>'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/application.rb:103:in `require'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_prerequisites'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/bin/rake:23:in `load'
/Users/anirudhmaheshwari/.rbenv/versions/2.0.0-p247/bin/rake:23:in `<main>'
Tasks: TOP => db:schema:dump => environment

1 个答案:

答案 0 :(得分:0)

请更新第3行的config / routes.rb文件