On Friday, March 21, 2014 12:13:30 PM UTC-4, Rick wrote:
i would put the image in assets/images and refer to it as:
I’m hoping that Dave has already resolved this and moved on, but since a
lot of people are viewing this thread, I wanted to update it. I
this in coffeescript and re-tested. Just to be clear, I’m testing in
4. The pipeline treatment for images was changed with Rails 4, so it’s
likely there would be a different result if you’re running in Rails 3.1
3.2. Also, my production environment is the default production
and assets are pre-compiled.
Dave’s original reference of ‘assets/Jumbotron2.png’ worked in
but not in production, the same result he had.
The second solution of putting the image in public/imagesJumbotron2.png
referencing ‘/images/Jumbotron.png’ worked in both production and
development. FYI, the colon also worked when I re-wrote in
The third solution from Rick to reference url(“Jumbotron2.png”) was a
little surprising. I had expected it to work in development and not in
production. It actually didn’t work in either one. In production, it’s
working for the same reason as Dave’s original statement. The pipeline
doesn’t load in production so it either finds the image somewhere in the
public directory or it doesn’t load. In development, I have learned
you must either use a helper (such as asset_path) or you must reference
assets/ directory as Dave did to trigger the pipeline processing.