I don't understand how it ever worked at all, now that I understand a
bit more. I have a .js.coffee file in assets/javascripts that has in
it lines like
@marker_icon_red = new OpenLayers.Icon('/assets/red_pin.png', size, offset);
so there is nothing to convert the url to digest version. Yet this
has been working fine for several years. So somehow the url
/assets/red_pin.img has been satisfied.
I can only think that somehow copies of the original .png files
existed in public/assets, along with the digest versions. Perhaps
they were copied there on the server by someone years ago to make it
work and they have been there ever since. I think the proper solution
is to change the file to .js.coffee.erb and then I can use the helper
as described in section 2.3.3
https://guides.rubyonrails.org/asset_pipeline.html
On Wed, 6 Mar 2019 at 15:29, Walter Lee Davis <waltd@wdstudio.com> wrote:
>
>
> > On Mar 6, 2019, at 10:16 AM, Colin Law <clanlaw@gmail.com> wrote:
> >
> > On Wed, 6 Mar 2019 at 14:47, Walter Lee Davis <waltd@wdstudio.com> wrote:
> >>
> >>
> >>> On Mar 6, 2019, at 9:27 AM, Walter Lee Davis <waltd@wdstudio.com> wrote:
> >>>
> >>> The asset pipeline needs a JavaScript interpreter to work correctly on the server. I usually install whatever version of Node.js is available in a package manager. Alternatively, you can use the gem `therubyracer` to do the same thing. If you have that dependency filled, then I'm fresh out of ideas.
> >
> > Thanks for the suggestions Walter
> > I have checked nodejs is installed (node -v shows 10.x)
> >
> >>
> >> Make sure that this works, on the server:
> >>
> >> RAILS_ENV=production rake assets:precompile
> >
> > Yes it does work, it outputs nothing, as expected. The code has been
> > checked out of the git repo, which doesn't include the public/assets
> > folder and the compiled assets are there ok.
> > I just realised that I was wrong about the css, that isn't found either.
> >
> > One thing that confuses me, in the nginx log I see entries like
> > GET /assets/red_pin.png HTTP/1.1" 404 457 ...
> > Should the url not be the full name including the digest?
>
> Yes, at the NGINX level, the request should be for the actual file path. In the Rails app, there would be a helper call like asset_url('red_pin.png'), which would generate the full path including the fingerprint.
>
> > Even more confusingly I am informed that if I access the server from
> > another location then the images do appear, but I wonder whether that
> > one is seeing cached images. I haven't managed to capture the log
> > when that site issues a full refresh yet.
>
> Yes. If you want to bust the cache, there's an assets_version config attribute you can change. I think it's 1 by default, and you can increment it, and then precompile assets. Everything will change. But the question you have above would trump that, I think.
>
> Walter
>
> --
> 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 rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6127B556-0CB8-43CF-913D-A13BF4F60E26%40wdstudio.com.
> For more options, visit https://groups.google.com/d/optout.
--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuEG653QmEwLHaRJqArknTV-Yc3mOVNA0n0p1XK0yY%2Bkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment