Search code examples
ruby-on-railsassetsprecompile

Sprockets Rails Helper Asset Not Precompiled even though declared in config/initializers/assets.rb


I have a rails API with a mailer. In my mailer layout, I include an image :

<html>
  <body>
    <%= image_tag "quickbed_logo" %>
    <%= yield %>
  </body>
</html>

that is stored in app/assets/images.

However when I m sending the email I get :

Sprockets::Rails::Helper::AssetNotPrecompiled - Asset was not declared to be precompiled in production.
Add `Rails.application.config.assets.precompile += %w( quickbed_logo )` to `config/initializers/assets.rb` and restart your server:

I complied with the error message and added Rails.application.config.assets.precompile += %w( quickbed_logo ) to config/initializers/assets.rb

However I still get the error. What am I doing wrong ?


Solution

  • Add the extension to Rails.application.config.assets.precompile += %w( quickbed_logo.png ) because Rails cannot guess it.