title: Model not saving Paperclip avatar data
body: <p>I have a Rails 4 app that scrapes a given web page and saves the data in a <code>Link</code> model.</p>
  
  <p>I'm using the Paperclip gem in conjunction with the <code>after_save</code> callback to get the url of the image and then upload it to AWS S3. This all works fine and I can view the image in my S3 bucket.</p>
  
  <p>The problem I have is that the <code>avatar_file_name</code>, <code>avatar_content_type</code>, <code>avatar_file_size</code> and <code>avatar_updated_at</code> columns in the db remain <code>nil</code> as if there is no <code>:avatar</code> attached the the <code>Link</code></p>
  
  <p><code>link.rb:</code></p>
  
  <pre><code>class Link &lt; ActiveRecord::Base
  
    after_save :picture_from_url
  
    has_attached_file :avatar, styles: { medium: "300x300&gt;", thumb: "100x100&gt;" }, default_url: "/images/:style/missing.png"
    validates_attachment_content_type :avatar, content_type: /\Aimage\/.*\Z/
  
  ...
  
      def picture_from_url
        self.avatar = URI.parse(self.image_url)
      end
  
  end
  </code></pre>
  
  <p>UPDATE: with Controller code</p>
  
  <pre><code>class LinksController &lt; ApplicationController
  
  ...
  
    def new
      @link = Link.new
    end
  
    def create
      @link = Link.create(link_params)
      if @link.save
          flash[:success] = "Thanks for your submission!"
          redirect_to link_path(@link)
      else
          render :new
      end
    end
  
    private
    def link_params
      params.require(:link).permit(:title, :url, :content, :tag_list, :category, :image_url, :avatar).merge(user_id: current_user.id, author_first_name: current_user.first_name)
    end
  
  end
  </code></pre>