iprog.com

Missing assets in Rails 4.0 (part 1)

The asset pipeline was introduced in Rails 3.1. It continues to exist in Rails 4 and has seen a number of changes.

In one key change, Sprockets (the brains behind the asset pipeline) now looks in fewer places for asset files.

In Rails 3, Sprockets looked in app/assets, lib/assets, and vendor/assets for assets. Importantly, this applied not only to your main app, but also to any asset-providing gems, such as font-awesome-rails.

In Rails 4, Sprockets only looks in app/assets (both in your app and in gems). If you have any assets that aren’t working properly (most likely fonts, images, or CSS files not loading), first check for updated versions of any gems.

If it’s your own gem or a gem that hasn’t been updated, it may be as simple as moving lib/assets or vendor/assets to app/assets.

tags: rails4, assets, rails