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:
> :url("Jumbotron2.png")
>
>
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 re-wrote
this in coffeescript and re-tested. Just to be clear, I'm testing in Rails
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 or
3.2. Also, my production environment is the default production environment
and assets are pre-compiled.
Dave's original reference of 'assets/Jumbotron2.png' worked in development,
but not in production, the same result he had.
The second solution of putting the image in public/imagesJumbotron2.png and
referencing '/images/Jumbotron.png' worked in both production and
development. FYI, the colon also worked when I re-wrote in Coffeescript.
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 not
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 that
you must either use a helper (such as asset_path) or you must reference the
assets/ directory as Dave did to trigger the pipeline processing. Didn't
know that.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/3055b471-9249-4c2d-9290-b6351f24ee68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.