Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails3 asset pipeline and file collisions

I'm updating an existing rails 2 app to rails 3, and having some trouble understanding the asset pipeline. I have read through the guide and as I understand it, files in any of the following directories will resolve to /assets:

  • app/assets
  • lib/assets
  • vendor/assets

and you could access them using helpers...i.e.

image_tag('logo.png')

But what I don't understand is how collisions are handled? For example, what if there are the following files:

  • app/assets/images/logo.png
  • lib/assets/images/logo.png

If I go to myapp.com/assets/images/logo.png, which file will be returned? I could check for collisions manually within my app, but this becomes a pain point when using gems that rely on the asset pipeline.

like image 352
gmoniey Avatar asked Feb 13 '12 08:02

gmoniey


1 Answers

Based on what I've found, you can't have duplicate files, as rails will just return the first one found.

This seems like a bit of a design flaw, as a gem may not namespace their own assets

like image 103
gmoniey Avatar answered Nov 15 '22 09:11

gmoniey