asset_path in rails console on heroku for images

Viewed 4930

I'm using paperclip to deal with images.

To serve an image when none is provided by a user, I use the value provided by defaul_url, which is set to

ActionController::Base.helpers.asset_path('logo_medium.png')

This works fine locally: the src attribute of the image is set correctly.

On heroku, however, things break. The src attribute of the image has the value '/logo_medium.png', which is wrong.

Indeed, when I start up the rails console on heroku,

ActionController::Base.helpers.asset_path('logo_medium.png')

returns

/assets/logo_medium-f0bc5e00182468b861cf32c8c35595ce.png

which is correct.

I'm puzzled that the app seems to return something different from what the console does.

For the sake of completeness, my view uses

<%= image_tag @user.avatar.url(:medium) %>

Any help greatly appreciated.

1 Answers
Related