title: Heroku how to populate images carrierwave using file.open and rake
body: <pre><code>  rake db:populate (works)
    heroku run rake db:populate (works to some extent)
  </code></pre>
  
  <p>I ran into a problem when I tried to populate the database on heroku. Locally the following works perfectly and my website is populated with images. </p>
  
  <pre><code>  namespace :db do
       desc "Fill database with sample data"
       task populate: :environment do
       .
       .
       @uploader = ImageUploader.new(@movie_project, :image)
       @uploader.store!(File.open("app/assets/images/photos/picture.jpg"))
       @movie_project.image = @uploader
  </code></pre>
  
  <p>All MovieProjects are successfully populated with data(title, genre etc). Its only the image that doesn't get created on heroku. I suspect that this have something to do with the </p>
  
  <pre><code>  File.open
  </code></pre>
  
  <p>Tried things like changing directory but without success, maybe I just use the wrong directory</p>
  
  <pre><code>  app/assets/images =&gt; public/assets/ ?
  </code></pre>
  
  <p>I use cedar stack, rails 3.2, Carrierwave and the assets are precompiled before uploaded. This is just for testing purpose to test with different layouts. 
  Creating a MovieProject and assign a picture works on Heroku, but using the above methods doesn't seems to. </p>
  
  <p>//</p>
  
  <p>Thanks Jon</p>