in my rails 3 app I use devise. For the password reset form I have:
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<%= f.hidden_field :reset_password_token %>
......
I want to remove the devise_error_message and stick with the rails flash, but that’s not working as the errors are not being sent to flash?
<% flash.each do |key, value| %>
<div id="message-drawer">
<div class="message error">
<div class="message-inside"><span><%= value %></span>
</div>
</div>
</div>
<% end %>
flash is empty? Why? Thanks
flash is empty because those are model validation error messages which are printed using the helper method devise_error_message! . You can always override it:
https://github.com/plataformatec/devise/blob/master/app/helpers/devise_helper.rb
But it is a lot easier to customize your devise related messages via the I18n file:
config/locales/devise.en.yml