2016-05-11 13 views
-1

ユーザー情報を更新しようとしていますが、現在のパスワードを入力して更新をクリックすると、Current password can't be blankというメッセージが表示されます。パスワードを入力しても現在のパスワードを空白にすることはできません

<nav>バーを追加して、devise編集フォームの更新を行いましたが、それは問題ではないと思います。私はデフォルトのデバイスコントローラに何も変更を加えていません。

これは私の編集フォームです:

<% if vendor_signed_in? %> 
    <nav class="navbar navbar-inverse"> 
    <div class="container-fluid"> 
    <!-- Brand and toggle get grouped for better mobile display --> 
    <div class="navbar-header"> 
     <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> 
     <span class="sr-only">Toggle navigation</span> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     </button> 
     <%= link_to "Discount Now", edit_vendor_registration_path, class: "navbar-brand", id: "logo" %> 
    </div> 

    <!-- Collect the nav links, forms, and other content for toggling --> 
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> 
     <ul class="nav navbar-nav"> 
     <li> <%= link_to "Home", edit_vendor_registration_path %> </li> 
     </ul> 

     <ul class="nav navbar-nav navbar-right"> 
     <li>Signed in as <%= current_vendor.name %></li> 
     <li><%= link_to "log out", destroy_vendor_session_path,:method => :delete, id: "nav-login-button", type: "button", class: "btn btn-primary navbar-btn"%></li> 
     </ul> 
    </div><!-- /.navbar-collapse --> 
    </div><!-- /.container-fluid --> 
</nav> 


<body> 
<h2>Edit <%= resource_name.to_s.humanize %></h2> 

<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> 
    <%= devise_error_messages! %> 

    <div class="field"> 
    <%= f.label :email %><br /> 
    <%= f.email_field :email, autofocus: true %> 
    </div> 
    <div class="field"> 
    <%= f.label :address %><br /> 
    <%= f.text_field :address, autofocus: true %> 
    </div> 

    <div class="field"> 
    <%= f.label :discount_information %><br /> 
    <%= f.text_area :discount_info, autofocus: true %> 
    </div> 
    <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> 
    <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div> 
    <% end %> 

    <div class="field"> 
    <%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br /> 
    <%= f.password_field :password, autocomplete: "off" %> 
    </div> 

    <div class="field"> 
    <%= f.label :password_confirmation %><br /> 
    <%= f.password_field :password_confirmation, autocomplete: "off" %> 
    </div> 

    <div class="field"> 
    <%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br /> 
    <%= f.password_field :current_password, autocomplete: "off" %> 
    </div> 

    <div class="actions"> 
    <%= f.submit "Update" %> 
    </div> 
<% end %> 

<h3>Cancel my account</h3> 

<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p> 

<%= link_to "Back", :back %> 
</body> 
<%else %> 
<% link_to "sign up", new_vendor_session_path%> 
<% end %> 
+1

開いている一重引用符に問題があり、これが問題だと思います。単語**の一重引用符の後には、**:** **フィールドの行に**印をつけていないことに注意してください。この点からすべての文字列が文字列として扱われるため、テキストの色が変わります。 –

答えて

1

私はcurrent_passwordパラメータが許可されていないと思いますが、お使いのコンソールログを確認してください。許可されていないパラメータが表示されます。 devys登録コントローラまたはアプリケーションコントローラでconfigure_permitted_pa​​rametersメソッドで許可するようにしてください。それが動作することを願っています。

関連する問題