I made a helper_class
named: devise_helper.rb
:
module DeviseHelper
def devise_error_messages!
return '' if resource.errors.empty?
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
html = <<-HTML
<div class="alert alert-error alert-danger"> <button type="button"
class="close" data-dismiss="alert">×</button>
#{messages}
</div>
HTML
html.html_safe
end
end
for devise errors and made it custom style on application.css.scc
and imported <%= devise_error_messages! %>
inside both new.html.erb
of session and new.html.erb
of registration. But the problem that I have is when I test errors in sign-up page they are displayed beautifully above of my form but in sign-in page nothing happens. What is caused this problem? I also made a partial error messages:
<% flash.each do |key, value| %>
<div class="alert alert-<%= key %>">
<a href="#" data-dismiss="alert" class="close">×</a>
<ul>
<li>
<%= value %>
</li>
</ul>
</div>
<% end %>
and rendered it in my application.html.erb
Aucun commentaire:
Enregistrer un commentaire