Software creative always looking for a challenge

Quickly find where an asset is in Rails

Rails AssetPipeline is a great feautre. However, sometimes it gets really confusing as to where a resource is located. Imagine you had to upgrade a basic library like jQuery UI on an older Rails project. How would you go about doing that if you can’t simply find it as a gem in the gemfile and can’t seem to find it anywhere in the project.

Below is a simple script you can paste into your rails console to find where the file is located. It will loop through all the directories rails uses for assets and try to find the file you specify.

Enjoy :).

Be Sociable, Share!