“Routing Error No route matches {}” when omniauth failed on registration

(Original question was asked here:
http://stackoverflow.com/questions/11506734/routing-error-no-route-matches-when-omniauth-failed-on-registration)

I am using omniauth-identity and configure its “fail on registration”.

My files:

config/initializers/omniauth.rb

OmniAuth.config.logger = Rails.logger

Rails.application.config.middleware.use OmniAuth::Builder do
#…
provider :identity, on_failed_registration: lambda { |env|
IdentitiesController.action(:new).call(env)
}
end

config/routes.rb

Wie::Application.routes.draw do
root to: ‘categories#index’

ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config

match ‘auth/:provider/callback’, to: ‘sessions#create’
match ‘auth/failure’, to: ‘sessions#failure’
match ‘signout’, to: ‘sessions#destroy’, as: ‘signout’
resources :identities#, only: [:new]
resources :categories, path: ‘’, only: [:index] do
resources :entries, path: ‘’, only: [:index, :show]
end
end

app/controllers/identities_controller.rb

class IdentitiesController < ApplicationController
def new
ariane.add “New Account”

@identity = env['omniauth.identity']

end
end

When I have a failure on registration (passing incorrect mail), I get
the following:

in browser:

Routing Error

No route matches {} Try running rake routes for more information on
available routes.

in server log:

Started POST “/auth/identity/register” for 127.0.0.1 at 2012-07-16
17:35:48 +0300 (0.1ms) begin transaction Identity Exists (0.2ms) SELECT
1 AS one FROM “identities” WHERE “identities”.“email” = ‘foo’ LIMIT 1
(0.1ms) rollback transaction Processing by IdentitiesController#new as
HTML Parameters: {“utf8”=>“✓”, “authenticity_token”=>“HIDDEN :)>=”,
“name”=>"", “email”=>“foo”, “password”=>"[FILTERED]",
“password_confirmation”=>"[FILTERED]", “commit”=>“Register”}
Rendered identities/new.html.erb within layouts/application (11.2ms)
Completed 500 Internal Server Error in 44ms

ActionController::RoutingError (No route matches {}):
app/views/layouts/application.html.erb:35:in
_app_views_layouts_application_html_erb___1224394470845933684_70120630781720’
config/initializers/omniauth.rb:8:incall’
config/initializers/omniauth.rb:8:in `block (2 levels) in ’

Rendered
/Users/ayia/.rvm/gems/[email protected]/gems/actionpack-3.2.6/lib/action_dispatch/middleware/templates/rescues/routing_error.erb
within rescues/layout (0.6ms)

What can be the reason for this? What did I wrong?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs