Skip to content

Commit dce20b7

Browse files
authored
Merge pull request #5732 from heartcombo/fix-format
Fix passing of format option to devise_for call.
2 parents 7eccc91 + 46c2c39 commit dce20b7

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

lib/devise/rails/routes.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ def devise_for(*resources)
235235
options[:constraints] = (@scope[:constraints] || {}).merge(options[:constraints] || {})
236236
options[:defaults] = (@scope[:defaults] || {}).merge(options[:defaults] || {})
237237
options[:options] = @scope[:options] || {}
238-
options[:options][:format] = false if options[:format] == false
239238

240239
resources.map!(&:to_sym)
241240

@@ -462,7 +461,7 @@ def with_devise_exclusive_scope(new_path, new_as, options) #:nodoc:
462461
current_scope = @scope.dup
463462

464463
exclusive = { as: new_as, path: new_path, module: nil }
465-
exclusive.merge!(options.slice(:constraints, :defaults, :options))
464+
exclusive.merge!(options.slice(:constraints, :format, :defaults, :options))
466465

467466
if @scope.respond_to? :new
468467
@scope = @scope.new exclusive

test/routes_test.rb

-5
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ class CustomizedRoutingTest < ActionController::TestCase
205205

206206
test 'map with format false for sessions' do
207207
expected_params = {controller: 'devise/sessions', action: 'new'}
208-
expected_params[:format] = false
209208

210209
assert_recognizes(expected_params, {path: '/htmlonly_admin/sign_in', method: :get})
211210
assert_raise ExpectedRoutingError do
@@ -215,7 +214,6 @@ class CustomizedRoutingTest < ActionController::TestCase
215214

216215
test 'map with format false for passwords' do
217216
expected_params = {controller: 'devise/passwords', action: 'create'}
218-
expected_params[:format] = false
219217

220218
assert_recognizes(expected_params, {path: '/htmlonly_admin/password', method: :post})
221219
assert_raise ExpectedRoutingError do
@@ -225,7 +223,6 @@ class CustomizedRoutingTest < ActionController::TestCase
225223

226224
test 'map with format false for registrations' do
227225
expected_params = {controller: 'devise/registrations', action: 'new'}
228-
expected_params[:format] = false
229226

230227
assert_recognizes(expected_params, {path: '/htmlonly_admin/sign_up', method: :get})
231228
assert_raise ExpectedRoutingError do
@@ -235,7 +232,6 @@ class CustomizedRoutingTest < ActionController::TestCase
235232

236233
test 'map with format false for confirmations' do
237234
expected_params = {controller: 'devise/confirmations', action: 'show'}
238-
expected_params[:format] = false
239235

240236
assert_recognizes(expected_params, {path: '/htmlonly_users/confirmation', method: :get})
241237
assert_raise ExpectedRoutingError do
@@ -245,7 +241,6 @@ class CustomizedRoutingTest < ActionController::TestCase
245241

246242
test 'map with format false for unlocks' do
247243
expected_params = {controller: 'devise/unlocks', action: 'show'}
248-
expected_params[:format] = false
249244

250245
assert_recognizes(expected_params, {path: '/htmlonly_users/unlock', method: :get})
251246
assert_raise ExpectedRoutingError do

0 commit comments

Comments
 (0)