0

我是 Rails 新手,无法查明问题所在。我正在关注关于设计的 RailsCast 教程 #209,运行时出现错误:rails g devise:views

这是错误:

/Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:185:in `default_controller_and_action': missing :action (ArgumentError)
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:78:in `normalize_options!'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:61:in `initialize'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1304:in `new'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1304:in `add_route'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1284:in `decomposed_match'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1270:in `block in match'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1270:in `each'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1270:in `match'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:260:in `root'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1317:in `root'
from /Users/chanel.nalani/svn-work/gwb/trunk/PMOCCU/uidevise/config/routes.rb:8:in `block in <top (required)>'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/route_set.rb:282:in `eval_block'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/route_set.rb:260:in `draw'
from /Users/chanel.nalani/svn-work/gwb/trunk/PMOCCU/uidevise/config/routes.rb:1:in `<top (required)>'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:245:in `load'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:245:in `block in load'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:245:in `load'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/file_update_checker.rb:78:in `call'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/file_update_checker.rb:78:in `execute'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/initializable.rb:30:in `run'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/initializable.rb:54:in `each'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application.rb:136:in `initialize!'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/chanel.nalani/svn-work/gwb/trunk/PMOCCU/uidevise/config/environment.rb:5:in `<top (required)>'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:251:in `require'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:251:in `require'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application.rb:103:in `require_environment!'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/commands.rb:25:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

我更改了 ruby​​ 的版本以查看是否可以解决问题,但我无法找到确切的问题。有没有其他人遇到过这个错误?

4

1 回答 1

0

看起来您缺少一些需要完成的手动设置(正如@dougui 和@janders223 指出的那样,这很可能是您的路线),在您完成运行后立即打印在控制台上rails generate devise:install

===============================================================================

Some setup you must do manually if you haven't yet:

  1. Ensure you have defined default url options in your environments files. Here 
     is an example of default_url_options appropriate for a development environment 
     in config/environments/development.rb:

       config.action_mailer.default_url_options = { :host => 'localhost:3000' }

     In production, :host should be set to the actual host of your application.

  2. Ensure you have defined root_url to *something* in your config/routes.rb.
     For example:

       root :to => "home#index"

  3. Ensure you have flash messages in app/views/layouts/application.html.erb.
     For example:

       <p class="notice"><%= notice %></p>
       <p class="alert"><%= alert %></p>

  4. If you are deploying Rails 3.1 on Heroku, you may want to set:

       config.assets.initialize_on_precompile = false

     On config/application.rb forcing your application to not access the DB
     or load models when precompiling your assets.

===============================================================================

取自https://github.com/plataformatec/devise/blob/master/lib/generators/templates/README

于 2012-07-17T11:22:01.283 回答