Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After updating to gon 3.0.2 rails helper method not working #42

Open
brian-mann opened this issue May 11, 2012 · 8 comments
Open

After updating to gon 3.0.2 rails helper method not working #42

brian-mann opened this issue May 11, 2012 · 8 comments

Comments

@brian-mann
Copy link

The rails helper methods: path_to_image and image_path (same thing, 1 is an alias) now return /images/YOURIMAGE.PNG instead of /assets/YOURIMAGE.PNG which is what it's supposed to return.

If I revert to an older version of gon -- say 2.3.0 the helper methods work as intended.

@gazay
Copy link
Owner

gazay commented May 11, 2012

Hello, can you provide a little bit more information about your environment, because on new rails app with gon 3.0.2 and rabl and jbuilder I have normal assets path through helpers:

Gemfile

gem 'rails', '3.2.3'
gem 'rabl'
gem 'jbuilder'
gem 'gon', '3.0.2'

home/index.html.erb

<h1>Hello</h1>
<%= path_to_image('rails.png') %>

result - http://cl.ly/0N422w0R1m3w0v2N231d

@brian-mann
Copy link
Author

Thanks for responding so quickly... I'd be happy to do a bit more testing. I'm actually headed out of town in a few hours so I'll work on this the next time I get the chance.

@gazay
Copy link
Owner

gazay commented Jun 22, 2012

any updates?

@gazay gazay closed this as completed Jul 24, 2012
@SokratisVidros
Copy link

Same issue with gon-5.0.4 and rails-4.0.5.

@andrey-skat
Copy link

rails 4.2.4, gon 6.0.1 - same issue

I found that when gon calls for compute_asset_path it not enters in Sprockets::Rails::Helper#compute_asset_path but in ActionView::Helpers::AssetUrlHelper.compute_asset_path.

But when I pointed it to right method, it just not calculates asset_digest_path.

@gazay gazay reopened this Jan 22, 2016
@ghost
Copy link

ghost commented Jan 29, 2016

I take a stub at this issue.

Gemfile

  --snip--
gem 'rails', '4.2.4'
gem 'gon', '6.0.1'
  --snip--

views/homes/index.html.erb

<h1>Hello</h1>
<%= compute_asset_path 'rails.png' %>

Below is result.

a

@ghost
Copy link

ghost commented Jan 29, 2016

I think that if you use sprockets, compute_asset_path calls Sprockets::Rails::Helper#compute_asset_path and if you do not use sprockets, compute_asset_path calls ActionView::Helpers::AssetUrlHelper#compute_asset_path.

References

@andrey-skat
Copy link

As I sad when it calls Sprockets it didn't calculate asset_digest_path.
In your stub you use .erb and not gon + jbuilder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants