Ask A Question

Notifications

You’re not receiving notifications from this thread.

Shrine default_url with webpacker

Dieter Lunn asked in Rails

I am using Rails 6.1.1 with webpacker and Shrine. The issue I am coming across is using the default URL plugin with webpacker based assets. When I use it in development it seems to load just fine but seems to be using sprockets, however, when I go to production mode I keep getting file not found errors. Is it possible to use the webpacker helpers in my uploader?

Reply

I figured it out, and yes it is using the asset helper in the uploader.

  Attacher.default_url do |**_options|
    ActionController::Base.helpers.asset_pack_path "media/images/#{name}-missing.svg"
  end
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.