Skip to content

Instantly share code, notes, and snippets.

@sgringwe
Last active March 19, 2019 00:54
Show Gist options
  • Save sgringwe/8985439 to your computer and use it in GitHub Desktop.
Save sgringwe/8985439 to your computer and use it in GitHub Desktop.
rails 4 paperclip asset_path precompiled default_url
I was having trouble setting the default_url for paperclip attachables while using rails 4 asset pipeline fingerprints.
What was not working for some reason:
default_url: ActionController::Base.helpers.asset_path('event_default.jpg')
What worked for me:
default_url: lambda { |image| ActionController::Base.helpers.asset_path('event_default.jpg') }
Hope this helps someone
@paulmwatson
Copy link

Thank you, this solved my problem where it worked in development but not in production. lambda makes a little bit of sense though not obvious.

@fattakhov
Copy link

Thank you! 👍

@solutionizer
Copy link

👍

@PaulRHanson316
Copy link

Awesome! Thanks!!

@nimir
Copy link

nimir commented Oct 31, 2018

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment