ActionController :: RoutingError(没有路由匹配“/ users”):

时间:2011-07-12 03:23:01

标签: ruby-on-rails ruby-on-rails-3 devise

我正在使用rails 3 + devise。当用户注册并出现错误时。该应用程序重定向到:

http://localhost:3000/users

显示错误消息,但在日志中我看到以下内容:

Started POST "/users" for 127.0.0.1 at Mon Jul 11 20:22:19 -0700 2011
  Processing by RegistrationsController#create as HTML
  Parameters: {"commit"=>"Create my account", "fb_access_token"=>"XXXXX", "authenticity_token"=>"fWd/XXXX=", "utf8"=>"✓", "user"=>{"remember_me"=>"0", "lname"=>"XXXX", "fname"=>"XXXX", "password"=>"[FILTERED]", "email"=>"XXXX-inc.com"}, "fb_uuid"=>"312312"}
  SQL (0.1ms)  BEGIN
  User Load (0.2ms)  SELECT "users"."id" FROM "users" WHERE ("users"."email" = 'brett@companyline-inc.com') LIMIT 1
  SQL (0.2ms)  ROLLBACK
Rendered layouts/_header.html.erb (1.1ms)
Rendered registrations/new.html.erb within layouts/unauthorized (11.3ms)
Completed 200 OK in 45ms (Views: 22.6ms | ActiveRecord: 2.7ms)


Started GET "/users" for 127.0.0.1 at Mon Jul 11 20:22:20 -0700 2011

ActionController::RoutingError (No route matches "/users"):


Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.5/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.8ms)

routes.rb中:

  # OmniAuth - for FB Connect
  match '/users/auth/facebook/callback' => 'authentications#create'

  # Devise
  devise_for :users, :controllers => {:registrations => "registrations"}

为什么actionController错误?

1 个答案:

答案 0 :(得分:0)

rake routes告诉你什么?您放置路线的顺序也很重要,因为Rails路由器会选择匹配的第一条路线。

希望这有帮助!