Fix passing of format option to devise_for call.

This commit is contained in:
Vasiliy Ermolovich
2024-11-25 15:38:47 +01:00
parent 7eccc91f61
commit 46c2c3913e
2 changed files with 1 additions and 7 deletions

View File

@@ -235,7 +235,6 @@ module ActionDispatch::Routing
options[:constraints] = (@scope[:constraints] || {}).merge(options[:constraints] || {})
options[:defaults] = (@scope[:defaults] || {}).merge(options[:defaults] || {})
options[:options] = @scope[:options] || {}
options[:options][:format] = false if options[:format] == false
resources.map!(&:to_sym)
@@ -462,7 +461,7 @@ ERROR
current_scope = @scope.dup
exclusive = { as: new_as, path: new_path, module: nil }
exclusive.merge!(options.slice(:constraints, :defaults, :options))
exclusive.merge!(options.slice(:constraints, :format, :defaults, :options))
if @scope.respond_to? :new
@scope = @scope.new exclusive

View File

@@ -205,7 +205,6 @@ class CustomizedRoutingTest < ActionController::TestCase
test 'map with format false for sessions' do
expected_params = {controller: 'devise/sessions', action: 'new'}
expected_params[:format] = false
assert_recognizes(expected_params, {path: '/htmlonly_admin/sign_in', method: :get})
assert_raise ExpectedRoutingError do
@@ -215,7 +214,6 @@ class CustomizedRoutingTest < ActionController::TestCase
test 'map with format false for passwords' do
expected_params = {controller: 'devise/passwords', action: 'create'}
expected_params[:format] = false
assert_recognizes(expected_params, {path: '/htmlonly_admin/password', method: :post})
assert_raise ExpectedRoutingError do
@@ -225,7 +223,6 @@ class CustomizedRoutingTest < ActionController::TestCase
test 'map with format false for registrations' do
expected_params = {controller: 'devise/registrations', action: 'new'}
expected_params[:format] = false
assert_recognizes(expected_params, {path: '/htmlonly_admin/sign_up', method: :get})
assert_raise ExpectedRoutingError do
@@ -235,7 +232,6 @@ class CustomizedRoutingTest < ActionController::TestCase
test 'map with format false for confirmations' do
expected_params = {controller: 'devise/confirmations', action: 'show'}
expected_params[:format] = false
assert_recognizes(expected_params, {path: '/htmlonly_users/confirmation', method: :get})
assert_raise ExpectedRoutingError do
@@ -245,7 +241,6 @@ class CustomizedRoutingTest < ActionController::TestCase
test 'map with format false for unlocks' do
expected_params = {controller: 'devise/unlocks', action: 'show'}
expected_params[:format] = false
assert_recognizes(expected_params, {path: '/htmlonly_users/unlock', method: :get})
assert_raise ExpectedRoutingError do