title: how to reference to an image in seeds.rb
body: <p>I use Carrierwave to upload images associated to my User model, which has a corresponding <code>picture</code> attribute that contains the name of the image file in a string field. Usually the name of the uploaded picture is stored in <code>public/uploads</code>. <br>Now I would like to seed my development database with sample users including the associated path to the profile picture. I tried to store my <code>pic1.jpg</code>, <code>pic2.jpg</code>, <code>pic3.jpg</code> pictures in <code>public/images</code> and reference to these pictures in <code>db/seeds.rb</code> as <code>picture: '/images/pic1.jpg'</code> etc, like Grant Neufeld suggested in an <a href="https://stackoverflow.com/a/48064693/5078888">old stackoverflow question</a>. In view the picture is included using the following code:</p>
  
  <pre><code>&lt;%= image_tag @user.picture.url if @user.picture? %&gt;
  </code></pre>
  
  <p>However this does not work, the image is not loaded into view, because the picture attribute is nil. I also tried to store my pictures in <code>app/assets/images</code> and reference them as <code>picture: 'pic1.jpg'</code>, <code>picture: 'pic2.jpg'</code>, <code>picture: 'pic3.jpg'</code> in <code>db/seeds.rb</code> without result. </p>
  
  <p>Below is my <code>db/seeds.rb</code> file:</p>
  
  <pre><code>User.create!(name:  "Example User",
           email: "example@railstutorial.org",
           password:              "foobar",
           password_confirmation: "foobar",
           admin: true,
           politics: 'left',
           car: true,
           pets: 'I like horses and bears',
           music: 'American country and folk',
           picture: 'pic1.jpg',
           profile: 'I like music and the Ruby and Python programming languages',
           activated: true,
           activated_at: Time.zone.now)
  
  User.create!(name:  "Super-friendly User",
          email: "example-101@railstutorial.org",
          password:              "PassWord-0",
          password_confirmation: "PassWord-0",
          admin: true,
          smoker: true,
          politics: 'left',
          car: true,
          pets: 'I like turtles and whales',
          car_pets: true,
          music: 'Jazz and blues',
          picture: 'pic2.jpg',
          profile: 'I like music and drinking',
          activated: true,
          activated_at: Time.zone.now)
  
  User.create!(name:  "Friendly User",
          email: "example-102@railstutorial.org",
          password:              "PassWord-0",
          password_confirmation: "PassWord-0",
          politics: 'right',
          car: true,
          pets: 'I like snakes and gorillas',
          music: 'pop and classics',
          picture: 'pic3.jpg',
          profile: 'I like music and hiking',
          activated: true,
          activated_at: Time.zone.now)
  
  99.times do |n|
    name  = Faker::Name.name
    email = "example-#{n+1}@railstutorial.org"
    password = "password"
    User.create!(name:  name,
             email: email,
             password:              password,
             password_confirmation: password,
             activated: true,
             activated_at: Time.zone.now)
  end
  </code></pre>