title: Rails Image Not Showing Up With Paperclip
body: <p>I am trying to get an avatar to show up on my main page.  I am using Paperclip to do this.  However, whenever I try to show the image I get this:</p>
  
  <p><img src="https://i.stack.imgur.com/Pgndc.png" alt="enter image description here"></p>
  
  <p>This is what my code looks like:</p>
  
  <p><strong>View:</strong>
      </p>
  
  <pre><code>  &lt;head&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
      &lt;h1&gt;Users&lt;/h1&gt;
      &lt;table&gt;
        &lt;tr&gt;
          &lt;th colspan="1"&gt;&lt;/th&gt;
        &lt;/tr&gt;
  
        &lt;%= image_tag @user.avatar.url %&gt;
        &lt;%= debug @user.avatar.url %&gt;
  
        &lt;tr&gt;
          &lt;%= @user.username %&gt;
        &lt;/tr&gt;
  
      &lt;/table&gt;
    &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>The @user.username does display correctly.  As does any other property I try to display.
  The debug statement returns with:  "--- /images/original/missing.png?1400548644"</p>
  
  <p>However, I can find the images here:</p>
  
  <pre><code>./public/system/users/avatars/000/000/001/original/myImage.png
  </code></pre>
  
  <p>It cannot be found here, though:</p>
  
  <pre><code>./app/assets/images
  </code></pre>
  
  <p>Is it getting saved in the wrong place perhaps?
  Here is the rest of my code for reference:</p>
  
  <p><strong>Model:</strong></p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  
    attr_accessor :password
    attr_accessor :avatar_file_name
  
    EMAIL_REGEX = /\A[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\z/i
    has_attached_file :avatar, :styles =&gt; { :medium =&gt; "300x300&gt;", :thumb =&gt; "100x100&gt;" }, :default_url =&gt; "/images/:style/missing.png"
    validates_attachment_content_type :avatar, :content_type =&gt; /\Aimage\/.*\Z/
    validates :username, :presence =&gt; true, :uniqueness =&gt; true, :length =&gt; { :in =&gt; 3..20 }
    validates :email, :presence =&gt; true, :uniqueness =&gt; true, :format =&gt; EMAIL_REGEX
    validates :password, :confirmation =&gt; true #password_confirmation attr
    validates_length_of :password, :in =&gt; 6..20, :on =&gt; :create
    before_save :encrypt_password
    after_save :clear_password
  
    def encrypt_password
      if password.present?
        self.salt = BCrypt::Engine.generate_salt
        self.encrypted_password= BCrypt::Engine.hash_secret(password, salt)
      end
    end
  
    def clear_password
      self.password = nil
    end
  
    def self.authenticate(username_or_email="", login_password="")
      if  EMAIL_REGEX.match(username_or_email)
        user = User.find_by_email(username_or_email)
      else
        user = User.find_by_username(username_or_email)
      end
      if user &amp;&amp; user.match_password(login_password)
        return user
      else
        return false
      end
    end
  
    def match_password(login_password="")
      encrypted_password == BCrypt::Engine.hash_secret(login_password, salt)
    end
  
  end
  </code></pre>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>class UsersController &lt; ApplicationController
    before_filter :save_login_state, :only =&gt; [:new, :create]
  
    def index
      @users = User.all
      @user = User.find(params[:id])
    end
  
    def new
      @user = User.new
    end
  
    def create
      @user = User.new(user_params)
      if @user.save
        flash[:notice] = "You signed up successfully"
        flash[:color]= "valid"
      else
        flash[:notice] = "Form is invalid"
        flash[:color]= "invalid"
      end
      render "new"
    end
  
  private
  
    def user_params
      params.require(:user).permit(:username, :email, :password, :avatar)
    end
  
  end
  </code></pre>
  
  <p><strong>Users Database:</strong></p>
  
  <pre><code>class CreateUsers &lt; ActiveRecord::Migration
    def change
      create_table :users do |t|
        t.string :username
        t.string :email
        t.string :encrypted_password
        t.string :salt
        t.timestamps
      end
    end
  end
  </code></pre>
  
  <p><strong>Avatar Attachment to users database:</strong></p>
  
  <pre><code>class AddAttachmentAvatarToUsers &lt; ActiveRecord::Migration
    def self.up
      change_table :users do |t|
        t.attachment :avatar
      end
    end
  
    def self.down
      drop_attached_file :users, :avatar
    end
  end
  </code></pre>
  
  <p>I have been stuck on this problem for quite a while.  Any ideas or suggestions would be highly appreciated.  Thanks!</p>
  
  <p>EDIT:<br>
  <strong>Code to add avatar</strong></p>
  
  <p><strong>views/user/new</strong></p>
  
  <pre><code>  &lt;body&gt;
      &lt;% @page_title = "foos-tracker | Signup" %&gt;
      &lt;div class="Sign_Form"&gt;
        &lt;h1&gt;Sign Up&lt;/h1&gt;
        &lt;%= form_for(:user, :url =&gt; {:controller =&gt; 'users', :action =&gt; 'create'}, :html =&gt; { :multipart =&gt; true }) do |f| %&gt;
          &lt;p&gt; Username:&lt;/br&gt; &lt;%= f.text_field :username%&gt; &lt;/p&gt;
          &lt;p&gt; Email:&lt;/br&gt; &lt;%= f.text_field :email%&gt; &lt;/p&gt;
          &lt;p&gt; Password:&lt;/br&gt; &lt;%= f.password_field :password%&gt;&lt;/p&gt;
          &lt;p&gt; Password Confirmation:&lt;/br&gt; &lt;%= f.password_field :password_confirmation%&gt; &lt;/p&gt;
          &lt;%= f.file_field :avatar %&gt;
          &lt;%= f.submit :Signup %&gt;
        &lt;% end %&gt;
  
        &lt;% if @user.errors.any? %&gt;
          &lt;ul class="Signup_Errors"&gt;
          &lt;% for message_error in @user.errors.full_messages %&gt;
            &lt;li&gt;* &lt;%= message_error %&gt;&lt;/li&gt;
          &lt;% end %&gt;
          &lt;/ul&gt;
        &lt;% end %&gt;
      &lt;/div&gt;
    &lt;/body&gt;
  </code></pre>
  
  <p><strong>controllers/users_controller</strong></p>
  
  <pre><code>  def create
      @user = User.new(user_params)
      if @user.save
        flash[:notice] = "You signed up successfully"
        flash[:color]= "valid"
      else
        flash[:notice] = "Form is invalid"
        flash[:color]= "invalid"
      end
      render "new"
    end
  </code></pre>