忘れたパスワードのリンクがあるログインフォームがあります。クリックすると、メールアドレスを入力する場所のポップアップが現れます。 正しい/既存の電子メールを入力しても問題ありませんが、間違った電子メールを入力した場合、または電子メールがデータベースに存在しない場合は、 エラーメッセージは表示されません。助けてください。devise機能付きのモーダルでエラーメッセージを忘れた場合の表示方法
<%= devise_error_messages! %>
を使ってみましたが、使用しませんでした。私はエラーを表示するためにjQuery/javascriptの機能をinorderで使用しなければならないと思います。しかし、どのように モデル自体に表示するには? これが私の見解です:
<div class="container">
<div class="section section-signup">
<%= semantic_form_for(@resource, :as => resource_name, :url => user_session_path, :remote => true, :format => :json, :html => { :id => 'mainLogin' }) do |f| %>
<%= f.inputs do %>
<%= f.input :email, :label => 'Your email address', :input_html => { :placeholder => "Email"} %>
<%= f.input :password, :label => 'Your password', :input_html => { :placeholder => "Password"} %>
<% end %>
<%= f.buttons do %>
<% if devise_mapping.rememberable? %>
<%= f.input :remember_me, :as => :boolean, :label => "Remember me on this computer", :required => false, :input_html => {:class => "remember-me"} %>
<% end %>
<%= f.commit_button :label => 'Sign me in', :button_html => {:class => 'login submit button', :disable_with => 'Wait...', :id => 'user_submit' }%>
<% end %>
<div class="forgot">Yikes: <a class="pass-reset-btn cboxElement" href="#pass-reset" data-toggle="modal" data-target="#myModal">I forgot my password!</a></div>
<% end %>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Password reset</h4>
</div>
<div class="modal-body">
<p>Enter your email address and we'll shoot you a link for resetting your password.</p>
<!-- Start Fromtastic Markup -->
<%= semantic_form_for(resource_name, :url => password_path(resource_name), :remote => true, :format => :json, :html => { :id => 'password_reset' }) do |f| %>
<%= f.inputs do %>
<%= f.input :email, :label => 'Your email address', :input_html => { :placeholder => "Enter your email..."}%>
<% end %>
<%= f.buttons do %>
<%= f.commit_button :label => 'Send me that link', :button_html => {:class => 'submit button', :disable_with => 'Wait...' }%>
<% end %>
<div class="clearfix"></div>
<% end %>
<!-- End Fromtastic Markup -->
</div>
</div>
</div>
</div>
<%= devise_error_messages! %>はページの更新にのみ作用します –