Can't resolve image into URL: undefined method `start_with?' for /\.(?:svg|eot|woff|ttf)$/:Regexp

Viewed 1134

Upgrading a Rails 5.2 project to Rails 6. After the upgrade, when I try to pull up the site, I'm getting the following error:

Can't resolve image into URL: undefined method `start_with?' for /\.(?:svg|eot|woff|ttf)$/:Regexp

This is code:

def source_image(source)
    if source == 'blah'
        return image_tag 'blah.png', size: '18', :title => 'blah', :data => {:toggle => 'tooltip', :placement => 'right', }
    end
end
1 Answers

Visit config/initializer/assets.rb

Change

Rails.application.config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/

To This

Rails.application.config.assets.precompile << ["*.svg", "*.eot", "*.woff", "*.ttf"]
Related