Rails 4:设计和无法弥补的错误

时间:2013-04-24 06:35:16

标签: ruby-on-rails ruby devise omniauth

我在Rails 4应用程序中使用了devise和omniauth。我从这个页面做了所有动作(来自回答):

Devise, Omniauth and Facebook integration session error

将此:omniauthable 添加到 这个字符串

devise :database_authenticatable, :registerable, :confirmable,
         :recoverable, :rememberable, :trackable, :validatable

,我收到错误:

/home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:193:in `normalize_conditions!': You should not use the `match` method in your router without specifying an HTTP method. (RuntimeError)
If you want to expose your action to GET, use `get` in the router:

  Instead of: match "controller#action"
  Do: get "controller#action"
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:64:in `initialize'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:1425:in `new'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:1425:in `add_route'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:1404:in `decomposed_match'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:1386:in `block in match'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:1386:in `each'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:1386:in `match'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/devise-1.5.4/lib/devise/rails/routes.rb:365:in `devise_omniauth_callback'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/devise-1.5.4/lib/devise/rails/routes.rb:212:in `block (4 levels) in devise_for'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/devise-1.5.4/lib/devise/rails/routes.rb:212:in `each'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/devise-1.5.4/lib/devise/rails/routes.rb:212:in `block (3 levels) in devise_for'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/devise-1.5.4/lib/devise/rails/routes.rb:376:in `with_devise_exclusive_scope'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/devise-1.5.4/lib/devise/rails/routes.rb:211:in `block (2 levels) in devise_for'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/devise-1.5.4/lib/devise/rails/routes.rb:311:in `block in devise_scope'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:833:in `block in constraints'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:716:in `scope'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:833:in `constraints'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/devise-1.5.4/lib/devise/rails/routes.rb:310:in `devise_scope'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/devise-1.5.4/lib/devise/rails/routes.rb:209:in `block in devise_for'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/devise-1.5.4/lib/devise/rails/routes.rb:192:in `each'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/devise-1.5.4/lib/devise/rails/routes.rb:192:in `devise_for'
    from /home/u164/nikita/projects/domain-inspect/config/routes.rb:2:in `block in <top (required)>'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/route_set.rb:320:in `instance_exec'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/route_set.rb:320:in `eval_block'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/route_set.rb:298:in `draw'
    from /home/u164/nikita/projects/domain-inspect/config/routes.rb:1:in `<top (required)>'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:222:in `load'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:222:in `block in load'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:213:in `load_dependency'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:222:in `load'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:40:in `each'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:40:in `load_paths'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:16:in `reload!'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:26:in `block in updater'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.beta1/lib/active_support/file_update_checker.rb:75:in `call'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.beta1/lib/active_support/file_update_checker.rb:75:in `execute'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:27:in `updater'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:30:in `run'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:150:in `block in tsort_each'
    from /home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
    from /home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:219:in `each_strongly_connected_component_from'
    from /home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
    from /home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:180:in `each'
    from /home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
    from /home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/application.rb:213:in `initialize!'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /home/u164/nikita/projects/domain-inspect/config/environment.rb:5:in `<top (required)>'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:228:in `require'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:228:in `block in require'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:213:in `load_dependency'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:228:in `require'
    from /home/u164/nikita/projects/domain-inspect/config.ru:3:in `block in <main>'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
    from /home/u164/nikita/projects/domain-inspect/config.ru:in `new'
    from /home/u164/nikita/projects/domain-inspect/config.ru:in `<main>'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/commands/server.rb:46:in `app'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/commands/server.rb:71:in `start'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/commands.rb:78:in `block in <top (required)>'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/commands.rb:73:in `tap'
    from /home/u164/.rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.beta1/lib/rails/commands.rb:73:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

我该怎么办?或者现在有办法在轨道4应用程序中使用设计?

UPD 1

这是我的routes.rb

DomainInspect::Application.routes.draw do
  devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" ,:registrations => "registrations" }
  root :to => 'pages#main'
  resources :users, only: [:show, :edit, :update]
  resources :domains
end

1 个答案:

答案 0 :(得分:4)

最新版本的设计(v2.2.3 as of this writing)目前不支持Rails 4。但是目前有an active pull request open.

因此,在合并并释放到野外之前,您可以指定Gemfile使用以下内容:

gem 'devise', :github => 'plataformatec/devise', :branch => 'rails4'