Merge pull request #1661 from mreinsch/fix_subdomain_routing
fix for when using :host in routes
This commit is contained in:
commit
a0a141b457
|
@ -200,7 +200,8 @@ module ActionDispatch::Routing
|
|||
options[:path_names] = (@scope[:path_names] || {}).merge(options[:path_names] || {})
|
||||
options[:constraints] = (@scope[:constraints] || {}).merge(options[:constraints] || {})
|
||||
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)
|
||||
|
||||
|
|
|
@ -58,6 +58,10 @@ Rails.application.routes.draw do
|
|||
# Other routes for routing_test.rb
|
||||
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
|
||||
devise_for :accounts, :class_name => "Admin", :path_names => { :sign_in => "get_in" }
|
||||
end
|
||||
|
|
|
@ -128,6 +128,10 @@ class CustomizedRoutingTest < ActionController::TestCase
|
|||
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
|
||||
assert_raise ActionController::RoutingError do
|
||||
assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, 'reader/sessions/new')
|
||||
|
|
Loading…
Reference in New Issue