mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Merge pull request #1661 from mreinsch/fix_subdomain_routing
fix for when using :host in routes
This commit is contained in:
commit
a0a141b457
3 changed files with 10 additions and 1 deletions
|
@ -200,7 +200,8 @@ module ActionDispatch::Routing
|
||||||
options[:path_names] = (@scope[:path_names] || {}).merge(options[:path_names] || {})
|
options[:path_names] = (@scope[:path_names] || {}).merge(options[:path_names] || {})
|
||||||
options[:constraints] = (@scope[:constraints] || {}).merge(options[:constraints] || {})
|
options[:constraints] = (@scope[:constraints] || {}).merge(options[:constraints] || {})
|
||||||
options[:defaults] = (@scope[:defaults] || {}).merge(options[:defaults] || {})
|
options[:defaults] = (@scope[:defaults] || {}).merge(options[:defaults] || {})
|
||||||
options[:options] = (@scope[:options] || {}).merge({:format => false}) if options[:format] == false
|
options[:options] = @scope[:options] || {}
|
||||||
|
options[:options][:format] = false if options[:format] == false
|
||||||
|
|
||||||
resources.map!(&:to_sym)
|
resources.map!(&:to_sym)
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,10 @@ Rails.application.routes.draw do
|
||||||
# Other routes for routing_test.rb
|
# Other routes for routing_test.rb
|
||||||
devise_for :reader, :class_name => "User", :only => :passwords
|
devise_for :reader, :class_name => "User", :only => :passwords
|
||||||
|
|
||||||
|
scope :host => "sub.example.com" do
|
||||||
|
devise_for :sub_admin, :class_name => "Admin"
|
||||||
|
end
|
||||||
|
|
||||||
namespace :publisher, :path_names => { :sign_in => "i_dont_care", :sign_out => "get_out" } do
|
namespace :publisher, :path_names => { :sign_in => "i_dont_care", :sign_out => "get_out" } do
|
||||||
devise_for :accounts, :class_name => "Admin", :path_names => { :sign_in => "get_in" }
|
devise_for :accounts, :class_name => "Admin", :path_names => { :sign_in => "get_in" }
|
||||||
end
|
end
|
||||||
|
|
|
@ -128,6 +128,10 @@ class CustomizedRoutingTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'subdomain admin' do
|
||||||
|
assert_recognizes({"host"=>"sub.example.com", :controller => 'devise/sessions', :action => 'new'}, {:host => "sub.example.com", :path => '/sub_admin/sign_in', :method => :get})
|
||||||
|
end
|
||||||
|
|
||||||
test 'does only map reader password' do
|
test 'does only map reader password' do
|
||||||
assert_raise ActionController::RoutingError do
|
assert_raise ActionController::RoutingError do
|
||||||
assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, 'reader/sessions/new')
|
assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, 'reader/sessions/new')
|
||||||
|
|
Loading…
Reference in a new issue