Improve deprecation message with example of how to remove it
The deprecation of `devise_error_messages!` wasn't super clear on what was happening and how to get rid of the message, not it has a more detailed explanation with an example of what to look for and what to replace it with. Closes #5257.
This commit is contained in:
parent
79d7eddfc3
commit
4f60544396
|
@ -1,14 +1,26 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DeviseHelper
|
||||
# Retain this method for backwards compatibility, deprecated in favour of modifying the
|
||||
# devise/shared/error_messages partial
|
||||
# Retain this method for backwards compatibility, deprecated in favor of modifying the
|
||||
# devise/shared/error_messages partial.
|
||||
def devise_error_messages!
|
||||
ActiveSupport::Deprecation.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] `DeviseHelper.devise_error_messages!`
|
||||
is deprecated and it will be removed in the next major version.
|
||||
To customize the errors styles please run `rails g devise:views` and modify the
|
||||
`devise/shared/error_messages` partial.
|
||||
[Devise] `DeviseHelper#devise_error_messages!` is deprecated and will be
|
||||
removed in the next major version.
|
||||
|
||||
Devise now uses a partial under "devise/shared/error_messages" to display
|
||||
error messages by default, and make them easier to customize. Update your
|
||||
views changing calls from:
|
||||
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
to:
|
||||
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
To start customizing how errors are displayed, you can copy the partial
|
||||
from devise to your `app/views` folder. Alternatively, you can run
|
||||
`rails g devise:views` which will copy all of them again to your app.
|
||||
DEPRECATION
|
||||
|
||||
return "" if resource.errors.empty?
|
||||
|
|
Loading…
Reference in New Issue