title: rails 4: Errno::ENOENT (No such file or directory @ rb_sysopen - /assets/
body: <p>I've just deployed my app to heroku and I'm having a lot of trouble trying to read some assets.</p>
  
  <p>I am trying to dynamically load some css from multiple files, then recompile them with some changes later. The line that keeps breaking is the first file load:</p>
  
  <pre><code>@css_asset_bootstrap = File.open(ActionController::Base.helpers.asset_path('bootstrap.css'), "r").read
  </code></pre>
  
  <p>which generates this error:</p>
  
  <pre><code>2015-04-07T23:30:50.098831+00:00 app[web.1]: Errno::ENOENT (No such file or directory @ rb_sysopen - /assets/bootstrap-2d25733981c30e34bd9aa0fb75388f08.css):
  </code></pre>
  
  <p>I've tried a lot of things, including moving all my assets to aws cloudfront. Is there a way to get around this? Works perfectly in development environment.</p>
  
  <p>Just to confirm a few things. I've successfully precompiled and uploaded the file. The file definately exists as I can see it in</p>
  
  <pre><code>heroku run bash
  cd /public/assets/
  </code></pre>
  
  <p>I can also see it when I moved the assets to cloudfront.</p>
  
  <p>Thanks.</p>
  
  <p><strong>edit 1:</strong>
  Not sure if this is important information, but with the file on cloudfront, I can run heroku run bash to start a shell session on heroku. Then I can:</p>
  
  <pre><code>curl http://xxx.cloudfront.net/assets/bootstrap-2d25733981c30e34bd9aa0fb75388f08.css
  </code></pre>
  
  <p>And get the file ok. I was thinking maybe it was a permissions error but everything is set to public and it all seems to work from heroku to the aws server.</p>