title: ActionController::ParameterMissing - param is missing or the value is empty: user:
body: <p>I am trying to update the attribute on clicking the button block or unblock. but its not getting updated in database and i get the error <code>param is missing or the value is empty: user</code> . even when the user id is passed i get this error. I am not able to find where my error is occuring </p>
  
  <p>This is my controller code:</p>
  
  <pre><code>class UserController &lt; ApplicationController
      before_action :set_user, only: [ :edit, :update]
  
      # GET /users
      # GET /users.json
      def index
        @users = User.all
      end
  
      def edit
      end
  
      def update
        respond_to do |format|
          if @user.update(user_params)
            format.html { redirect_to user_index_path, notice: 'User was successfully blocked.' }
          else
            format.html { render :index }
          end
        end
      end
  
      private
        # Use callbacks to share common setup or constraints between actions.
        def set_user
          @user = User.find(params[:id])
        end
  
        # Never trust parameters from the scary internet, only allow the white list through.
        def user_params
          params.require(:user).permit(:active)
        end
    end
  </code></pre>
  
  <p>This is my view code</p>
  
  <pre><code>&lt;h1&gt;
    User Details
  &lt;/h1&gt;
  &lt;table class="table"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;Users&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;% @users.each do |user| %&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;%= image_tag("/assets/image.jpg", style: "width: 60px; height: 60px;")%&gt;
          &lt;/td&gt;
          &lt;td&gt;
            &lt;p class="font-weight-bold"&gt;&lt;%= user.name %&gt;&lt;/p&gt;
            &lt;p&gt;&lt;%= user.email %&gt;&lt;/p&gt;
          &lt;/td&gt;
          &lt;td&gt;&lt;%= user.active %&gt;&lt;/td&gt;
          &lt;td&gt;
          &lt;% if user.active == true  %&gt;
          &lt;%= button_to "Block", user_path(id: user.id, value: false), class: 'btn btn-outline-dark',  :method =&gt; :patch %&gt;
          &lt;%else%&gt;
          &lt;%= button_to "Unblock", user_path(id: user.id, value: true), class: 'btn btn-outline-dark',  :method =&gt; :patch %&gt;
          &lt;%end%&gt;
        &lt;/td&gt;
        &lt;/tr&gt;
      &lt;% end %&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Terminal log i get</p>
  
  <pre><code>Started PATCH "/user/5?value=false" for 127.0.0.1 at 2018-04-12 14:49:57 +0530
      Processing by UserController#update as HTML
        Parameters: {"authenticity_token"=&gt;"RyL/KkxIbVtZXojmERByarlN1qxXH0gK7moq2w5s4ULketOYGh1im+qPLvND2HkOlVC8gePlFyGCns0lf/Z/uQ==", "value"=&gt;"false", "id"=&gt;"5"}
        User Load (0.3ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 5 ORDER BY `users`.`id` ASC LIMIT 1
        User Load (0.2ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 5 LIMIT 1
      Completed 401 Unauthorized in 3ms (ActiveRecord: 0.6ms)
  
  
  
      ActionController::ParameterMissing - param is missing or the value is empty: user:
        app/controllers/user_controller.rb:31:in `user_params'
        app/controllers/user_controller.rb:15:in `block in update'
        app/controllers/user_controller.rb:14:in `update'
  
      Started POST "/__better_errors/7f240c65d5c4ef9a/variables" for 127.0.0.1 at 2018-04-12 14:49:57 +0530
  </code></pre>