title: Rails - Paperclip dont save user avatar
body: <p>I installed paperclip gem to manage users avatars in app but when I trying to change user default avatar it doesn't change. I don't getting any errors and the form is saved correctly. It seems to photo isn't uploaded.</p>
  
  <p>What am I doing wrong? I'm newbie and I cant figure it out.</p>
  
  <p>Model:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :posts
    # Include default devise modules. Others available are:
    # :confirmable, :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable, :registerable,
           :recoverable, :rememberable, :trackable, :validatable
           has_attached_file :avatar, styles: { medium: "300x300&gt;", thumb: "100x100&gt;" }, default_url: "/images/avatar.gif"
           validates_attachment_content_type :avatar, content_type: /\Aimage\/.*\Z/
  end
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>class UsersController &lt; ApplicationController
  def create
    @user = User.create( user_params )
  end
  def update
      @user = User.find(params[:id])
      @user.update_attribute(:avatar, params[:user][:avatar])
  end
  private
  
  # Use strong_parameters for attribute whitelisting
  # Be sure to update your create() and update() controller methods.
  
  def user_params
    params.require(:user).permit(:avatar)
  end
  end
  </code></pre>
  
  <p>Edit view:</p>
  
  <pre><code>&lt;h2&gt;Edit &lt;%= resource_name.to_s.humanize %&gt;&lt;/h2&gt;
  
  &lt;%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %&gt;
    &lt;%= devise_error_messages! %&gt;
    &lt;form&gt;
      &lt;div class="form-group"&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label :email %&gt;&lt;br /&gt;
      &lt;%= f.email_field :email, autofocus: true, class: "form-control" %&gt;
    &lt;/div&gt;
  
    &lt;% if devise_mapping.confirmable? &amp;&amp; resource.pending_reconfirmation? %&gt;
      &lt;div&gt;Currently waiting confirmation for: &lt;%= resource.unconfirmed_email %&gt;&lt;/div&gt;
    &lt;% end %&gt;
  
    &lt;div class="field"&gt;
      &lt;%= f.label :password %&gt; &lt;i&gt;(leave blank if you don't want to change it)&lt;/i&gt;&lt;br /&gt;
      &lt;%= f.password_field :password, autocomplete: "off", class: "form-control" %&gt;
    &lt;/div&gt;
  
    &lt;div class="field"&gt;
      &lt;%= f.label :password_confirmation %&gt;&lt;br /&gt;
      &lt;%= f.password_field :password_confirmation, autocomplete: "off", class: "form-control" %&gt;
    &lt;/div&gt;
  
    &lt;div class="field"&gt;
      &lt;%= f.label :current_password %&gt; &lt;i&gt;(we need your current password to confirm your changes)&lt;/i&gt;&lt;br /&gt;
      &lt;%= f.password_field :current_password, autocomplete: "off", class: "form-control" %&gt;
    &lt;/div&gt;
    &lt;%= image_tag @user.avatar.url(:medium) %&gt;
    &lt;%= form_for @user, url: users_path, html: { multipart: true } do |form| %&gt;
    &lt;%= form.file_field :avatar %&gt;
  &lt;% end %&gt;
  &lt;br&gt;
    &lt;div class="actions"&gt;
      &lt;%= f.submit "Update", class: "btn btn-success" %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  &lt;/div&gt;&lt;/form&gt;
  &lt;p&gt;&lt;%= button_to "Delete my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-danger" %&gt;&lt;/p&gt;
  </code></pre>
  
  <p>My routes:</p>
  
  <pre><code>new_user_session GET    /users/sign_in(.:format)       devise/sessions#new
              user_session POST   /users/sign_in(.:format)       devise/sessions#create
      destroy_user_session DELETE /users/sign_out(.:format)      devise/sessions#destroy
             user_password POST   /users/password(.:format)      devise/passwords#create
         new_user_password GET    /users/password/new(.:format)  devise/passwords#new
        edit_user_password GET    /users/password/edit(.:format) devise/passwords#edit
                           PATCH  /users/password(.:format)      devise/passwords#update
                           PUT    /users/password(.:format)      devise/passwords#update
  cancel_user_registration GET    /users/cancel(.:format)        devise/registrations#cancel
         user_registration POST   /users(.:format)               devise/registrations#create
     new_user_registration GET    /users/sign_up(.:format)       devise/registrations#new
    edit_user_registration GET    /users/edit(.:format)          devise/registrations#edit
                           PATCH  /users(.:format)               devise/registrations#update
                           PUT    /users(.:format)               devise/registrations#update
                           DELETE /users(.:format)               devise/registrations#destroy
                categories GET    /categories(.:format)          categories#index
                    topics GET    /topics(.:format)              topics#index
                           POST   /topics(.:format)              topics#create
                 new_topic GET    /topics/new(.:format)          topics#new
                edit_topic GET    /topics/:id/edit(.:format)     topics#edit
                     topic GET    /topics/:id(.:format)          topics#show
                           PATCH  /topics/:id(.:format)          topics#update
                           PUT    /topics/:id(.:format)          topics#update
                           DELETE /topics/:id(.:format)          topics#destroy
                     posts GET    /posts(.:format)               posts#index
                           POST   /posts(.:format)               posts#create
                  new_post GET    /posts/new(.:format)           posts#new
                 edit_post GET    /posts/:id/edit(.:format)      posts#edit
                      post GET    /posts/:id(.:format)           posts#show
                           PATCH  /posts/:id(.:format)           posts#update
                           PUT    /posts/:id(.:format)           posts#update
                           DELETE /posts/:id(.:format)           posts#destroy
                     users GET    /users(.:format)               users#index
                           POST   /users(.:format)               users#create
                  new_user GET    /users/new(.:format)           users#new
                 edit_user GET    /users/:id/edit(.:format)      users#edit
                      user GET    /users/:id(.:format)           users#show
                           PATCH  /users/:id(.:format)           users#update
                           PUT    /users/:id(.:format)           users#update
                           DELETE /users/:id(.:format)           users#destroy
                      root GET    /                              categories#index
  </code></pre>
  
  <p>Record from DB:</p>
  
  <pre><code>  User Load (1.7ms)  SELECT "users".* FROM "users"
  =&gt; #&lt;ActiveRecord::Relation [#&lt;User id: 3, email: "mail@mail.com", encrypted_password: "$2a$10$/oH53eNleU4rc87OSYVtsANt...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, current_sign_in_at: "2016-03-17 11:10:39", last_sign_in_at: "2016-03-17 11:10:39", current_sign_in_ip: "::1", last_sign_in_ip: "::1", created_at: "2016-03-17 11:10:39", updated_at: "2016-03-17 11:10:39", avatar_file_name: nil, avatar_content_type: nil, avatar_file_size: nil, avatar_updated_at: nil&gt;]&gt;
  </code></pre>