Rails 4 and devise - current_password cannot be blank -


i'm using devise user log in , trying fix strong parameter issue. found solution , followed , tried solving problem. below code in application controller.

class applicationcontroller < actioncontroller::base   # prevent csrf attacks raising exception.   # apis, may want use :null_session instead.   protect_from_forgery with: :exception     before_filter :configure_permitted_parameters, if: :devise_controller?    protected    def configure_permitted_parameters     devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :first_name, :last_name, :user_name) }     devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:email, :password, :first_name, :last_name, :user_name, :current_paswword) }   end end 

this code enables me create user user_name, first_name , last_name. however, when try edit account, keep getting problem when entering updating account. keeps stating current password cannot blank though have entered password field. can me out? in advance

*updates*

edit account codes

<h2>edit <%= resource_name.to_s.humanize %></h2>  <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) |f| %>   <%= f.error_notification %>    <div class="form-inputs">     <%= f.input :email, :required => true, :autofocus => true %>     <%= f.input :first_name, :required => true, :autofocus => true %>     <%= f.input :last_name, :required => true, :autofocus => true %>     <%= f.input :user_name, :required => true, :autofocus => true %>     <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>       <p>currently waiting confirmation for: <%= resource.unconfirmed_email %></p>     <% end %>      <%= f.input :password, :autocomplete => "off", :hint => "leave blank if don't want change it", :required => false %>     <%= f.input :password_confirmation, :required => false %>     <%= f.input :current_password, :hint => "we need current password confirm changes", :required => true %>   </div>    <div class="form-actions">     <%= f.button :submit, "update" %>   </div> <% end %>  <h3>cancel account</h3>  <p>unhappy? <%= link_to "cancel account", registration_path(resource_name), :data => { :confirm => "are sure?" }, :method => :delete %></p>  <%= link_to "back", :back %> 

route file

tps::application.routes.draw   resources :staffs    devise_for :users   resources :courses   resources :schedules   resources :events   root to: 'courses#index'    match '/schedule_courses' => 'courses#schedule', via: :get end 

user.rb

class user < activerecord::base   # include default devise modules. others available are:   # :confirmable, :lockable, :timeoutable , :omniauthable   devise :database_authenticatable, :registerable,      :recoverable, :rememberable, :trackable, :validatable   # setup accessible (or protected) attributes model         end 


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -