title: ruby on rails record not being updated
body: <p>I'm using devise on my project, i want to update others profile from my admin panel, so only users with admin role can access it, since this behavior is very different to the default devise, i decided to create a separated controller, so i can manipulate users as normal records, but for some reason when i update users, the records are not updated into the database.</p>
  
  <p>THESE ARE MY ROUTES</p>
  
  <pre><code>  devise_for :users, controllers: { registrations: 'users/registrations' }
    root "users#index"
    post "users/:id" =&gt; "users#show"
    get "users/:id" =&gt; "users#show", as: :user
    patch "users/:id" =&gt; "users#show"
    resources :receipts
    resources :notes
  
    get "users/edit/:id" =&gt; "users#edit", as: :edit_user 
  </code></pre>
  
  <p>THIS IS MY CONTROLLER</p>
  
  <pre><code>def edit
      @user = User.find(params[:id])
  end
  
  def update
      user = User.find(params[:id])
      user.update(user_update_params)
      redirect_to user
  end
  
  private
      def user_update_params
          params.require(:user).permit(:username, :names, :last_names, :guardian, :phone, :identification, :role)
      end
  
      def user_params
          if @user.debts.nil?
              params.require(:user).permit(:debts)
          else
              params.require(:user).permit(:add_debt)
          end
      end
  </code></pre>
  
  <p>THESE IS MY VIEW</p>
  
  <pre><code>&lt;% if current_user &amp;&amp; current_user.has_role?(:admin) %&gt;
  
    &lt;div class="container form-bg"&gt;
          &lt;div class="row main"&gt;
            &lt;div class="panel-heading"&gt;
                     &lt;div class="panel-title text-center"&gt;
                          &lt;h1 class="title"&gt;Editar usuario&lt;/h1&gt;
                        &lt;hr /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
            &lt;div class="main-login main-center"&gt;
  
              &lt;%= form_for @user do |f| %&gt;
  
                &lt;div class="form-group"&gt;
                  &lt;%= f.label :username, "Usuario" ,class: "cols-sm-2 control-label" %&gt;&lt;br /&gt;
                  &lt;div class="cols-sm-10"&gt;
                    &lt;div class="input-group"&gt;
                      &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-user fa" aria-hidden="true"&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;%= f.text_field :username, autofocus: true, class: "form-control" %&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
  
                &lt;div class="form-group"&gt;
                  &lt;%= f.label :names, "Nombres" ,class: "cols-sm-2 control-label" %&gt;&lt;br /&gt;
                  &lt;div class="cols-sm-10"&gt;
                    &lt;div class="input-group"&gt;
                      &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-user fa" aria-hidden="true"&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;%= f.text_field :names, autofocus: true, class: "form-control" %&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
  
  
                &lt;div class="form-group"&gt;
                  &lt;%= f.label :last_names, "Apellidos" ,class: "cols-sm-2 control-label" %&gt;&lt;br /&gt;
                  &lt;div class="cols-sm-10"&gt;
                    &lt;div class="input-group"&gt;
                      &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-user fa" aria-hidden="true"&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;%= f.text_field :last_names, autofocus: true, class: "form-control" %&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
  
                &lt;div class="form-group"&gt;
                  &lt;%= f.label :phone, "Teléfono" ,class: "cols-sm-2 control-label" %&gt;&lt;br /&gt;
                  &lt;div class="cols-sm-10"&gt;
                    &lt;div class="input-group"&gt;
                      &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-phone fa" aria-hidden="true"&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;%= f.text_field :phone, autofocus: true, class: "form-control" %&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
  
                &lt;div class="form-group"&gt;
                  &lt;%= f.label :identification, "Número de identification" ,class: "cols-sm-2 control-label" %&gt;&lt;br /&gt;
                  &lt;div class="cols-sm-10"&gt;
                    &lt;div class="input-group"&gt;
                      &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-envelope fa" aria-hidden="true"&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;%= f.text_field :identification, autofocus: true, class: "form-control" %&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
  
  
                &lt;div class="form-group"&gt;
                  &lt;%= f.label :guardian, "Guardian legal" ,class: "cols-sm-2 control-label" %&gt;&lt;br /&gt;
                  &lt;div class="cols-sm-10"&gt;
                    &lt;div class="input-group"&gt;
                      &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-user fa" aria-hidden="true"&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;%= f.text_field :guardian, autofocus: true, class: "form-control" %&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
  
                &lt;div class="form-group "&gt;
                  &lt;label&gt;
                    &lt;%= f.radio_button :role, "student" , :checked =&gt; true %&gt;
                    Estudiante
                  &lt;/label&gt;
                  &lt;label&gt;
                    &lt;%= f.radio_button :role, "teacher" %&gt;
                    Profesor
                  &lt;/label&gt;
                &lt;/div&gt;
  
  
  
                &lt;div class="form-group"&gt;
                  &lt;%= f.label :password, "Contraseña" ,class: "cols-sm-2 control-label" %&gt;&lt;br /&gt;
                  &lt;div class="cols-sm-10"&gt;
                    &lt;div class="input-group"&gt;
                      &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-lock fa" aria-hidden="true"&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;% if @minimum_password_length %&gt;
                        &lt;em&gt;(&lt;%= @minimum_password_length %&gt; characters minimum)&lt;/em&gt;
                      &lt;% end %&gt;
                      &lt;%= f.password_field :password, autofocus: true, class: "form-control", autocomplete: "off" %&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
  
  
                &lt;div class="form-group"&gt;
                  &lt;%= f.label :password_confirmation, "Confirmar contraseña" ,class: "cols-sm-2 control-label" %&gt;&lt;br /&gt;
                  &lt;div class="cols-sm-10"&gt;
                    &lt;div class="input-group"&gt;
                      &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-lock fa" aria-hidden="true"&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;%= f.password_field :password_confirmation, autofocus: true, class: "form-control", autocomplete: "off" %&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
  
                &lt;div class="form-group "&gt;
                  &lt;%= f.submit "Editar", class: "btn btn-primary btn-lg btn-block login-button" %&gt;
                &lt;/div&gt;
  
              &lt;% end %&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;p class="invisible"&gt;asdsadsadsdsadsad&lt;/p&gt;
        &lt;/div&gt;
  &lt;% else %&gt;
    &lt;h1&gt;Acceso exclusivo para administradores&lt;/h1&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>So after reading my stack trace, it indeed tries to make the patch, but then it says that the params are not permitted, which is very weird since i already did permit them on my user_update_params method.</p>
  
  <p>this what appears on my trace</p>
  
  <pre><code>Started PATCH "/users/12" for ::1 at 2017-01-28 13:20:53 -0500
  Processing by UsersController#show as HTML
    Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"IdJKYYFVh8ZJJm/RPRJd7blfQw84Ct38KjE5tZ6fTuHFK8TG04MxUu2OtQv6wfLvFJll0EYYZa+ooxP19RqOAQ==", "user"=&gt;{"username"=&gt;"jimena", "names"=&gt;"Jimena44", "last_names"=&gt;"Delgado Díaz44", "phone"=&gt;"214123244", "identification"=&gt;"32312", "guardian"=&gt;"3213123", "role"=&gt;"student", "password"=&gt;"[FILTERED]", "password_confirmation"=&gt;"[FILTERED]"}, "commit"=&gt;"Editar", "id"=&gt;"12"}
    User Load (0.5ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", 12]]
  Unpermitted parameters: username, names, last_names, phone, identification, guardian, role, password, password_confirmation
  </code></pre>
  
  <p>So why are my files not being updated if it even redirects as it is intended on the controller?</p>
  
  <p>Thanks for reading.</p>