private method `update_without_password' called for nil:NilClass
<p>I am following <a href="http://hibbard.eu/authentication-with-devise-and-cancancan-in-rails-4-2/" rel="nofollow">this tutorial</a> on cancancan authentication, and specifically wanting admins to update users without needing a password. I've also seen <a href="http://www.rubydoc.info/github/plataformatec/devise/Devise/Models/DatabaseAuthenticatable:update_without_password" rel="nofollow">this</a> suggestion, but am unsure how to adapt it into my own code. When I click update, it says 'NoMethodError in UsersController#update' private method `update_without_password' called for nil:NilClass</p>

<p>My app returns all the user's params, so I don't understand what's happening here. Still very new to rails - let me know if you need any further information. Thank you in advance!</p>

<p>USERS CONTROLLER</p>

<pre><code>class UsersController &lt; ApplicationController
before_filter :authenticate_user!



 def update
  if user_params[:password].blank?
    user_params.delete(:password)
    user_params.delete(:password_confirmation)
  end


  successfully_updated = if needs_password?(@user, user_params)
                           @user.update(user_params)
                         else
                           @user.update_without_password(user_params)
                         end
 respond_to do |format|
    if successfully_updated
      format.html { redirect_to @user, notice: 'User was successfully updated.' }
      format.json { head :no_content }
    else
      format.html { render action: 'edit' }
      format.json { render json: @user.errors, status: :unprocessable_entity }
    end
  end


  rescue ActiveRecord::RecordNotFound
    respond_to_not_found(:js, :xml, :html)
  end


private
def needs_password?(user, params)
  params[:password].present?
end

def update_without_password(user_params)
  user.update_without_password(user_params)
end



def user_params
        params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :name, :role_id, :accepted)
end
</code></pre>

<p>EDIT FORM</p>

<pre><code>&lt;h3&gt;&lt;%= @user == @current_user ? "Your Account Settings" : "Edit User" %&gt;&lt;/h3&gt;

&lt;%= form_for(@user, :html =&gt; { :method =&gt; :put }) do |f| %&gt;
 &lt;p&gt;&lt;%= f.label :first_name %&gt;&lt;/p&gt;
 &lt;p&gt;&lt;%= f.text_field :first_name %&gt;&lt;/p&gt;

 &lt;p&gt;&lt;%= f.label :last_name %&gt;&lt;/p&gt;
 &lt;p&gt;&lt;%= f.text_field :last_name %&gt;&lt;/p&gt;

 &lt;p&gt;&lt;%= f.label :email %&gt;&lt;/p&gt;
 &lt;p&gt;&lt;%= f.text_field :email %&gt;&lt;/p&gt;
  &lt;% if can? :read, Role %&gt;
 &lt;%= collection_select(:user, :role_id, Role.all, :id, :name, {prompt: true}) %&gt;
  &lt;% end %&gt;
 &lt;p&gt;&lt;%= f.submit "Update" %&gt;&lt;/p&gt;
&lt;% end %&gt;
</code></pre>

<p>What am I missing here? Please let me know if should provide anything else. Thanks!!</p>