1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

fixed bug 'Could not find a valid mapping for path /users/auth/:provider/callback' when devise_for called inside scope

This commit is contained in:
bUg 2010-10-30 04:43:13 +08:00 committed by José Valim
parent d8f33b8925
commit c429fe8d1c
2 changed files with 3 additions and 3 deletions

View file

@ -40,8 +40,8 @@ module Devise
raise "Could not find a valid mapping for #{duck}"
end
def self.find_by_path!(path)
Devise.mappings.each_value { |m| return m if path.include?(m.fullpath) }
def self.find_by_path!(path, path_type=:fullpath)
Devise.mappings.each_value { |m| return m if path.include?(m.send(path_type)) }
raise "Could not find a valid mapping for path #{path}"
end

View file

@ -27,7 +27,7 @@ end
OmniAuth.config.path_prefix = nil
OmniAuth.config.on_failure = Proc.new do |env, key|
env['devise.mapping'] = Devise::Mapping.find_by_path!(env['PATH_INFO'])
env['devise.mapping'] = Devise::Mapping.find_by_path!(env['PATH_INFO'], :path)
controller_klass = "#{env['devise.mapping'].controllers[:omniauth_callbacks].camelize}Controller"
controller_klass.constantize.action(:failure).call(env)
end