Use Devise.responder.error_status instead of fixed :unprocessable_entity in confirmations and unlocks controllers

This commit is contained in:
Taketo Takashima
2025-09-12 14:54:00 +09:00
parent cf93de390a
commit ed625a804f
2 changed files with 4 additions and 4 deletions

View File

@@ -27,8 +27,8 @@ class Devise::ConfirmationsController < DeviseController
set_flash_message!(:notice, :confirmed)
respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
else
# TODO: use `error_status` when the default changes to `:unprocessable_entity`.
respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }
# Use `error_status` when the default changes to `:unprocessable_entity`.
respond_with_navigational(resource.errors, status: (Devise.responder.error_status != :ok) ? Devise.responder.error_status : :unprocessable_entity ){ render :new }
end
end

View File

@@ -29,8 +29,8 @@ class Devise::UnlocksController < DeviseController
set_flash_message! :notice, :unlocked
respond_with_navigational(resource){ redirect_to after_unlock_path_for(resource) }
else
# TODO: use `error_status` when the default changes to `:unprocessable_entity`.
respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }
# Use `error_status` when the default changes to `:unprocessable_entity`.
respond_with_navigational(resource.errors, status: (Devise.responder.error_status != :ok) ? Devise.responder.error_status : :unprocessable_entity ){ render :new }
end
end