1

I have a new rails application.

I want to add a javascript library and it contains a lot of resources.

When I put these files in app/assets/, I can't get them from my browser.

Example:
I have app/assets/img/bg.png, but when I use the URL http://localhost:3001/img/bg.png, I receive only No route matches [GET] "/img/bg.png"

Example 2:
I have app/assets/swf/ZeroClipboard.swf, but when I use the URL http://localhost:3001/swf/ZeroClipboard.swf, I receive only No route matches [GET] "/swf/ZeroClipboard.swf"

Example 3 (vendor assets):
I have app/vendor/swf/ZeroClipboard.swf, but when I use the URL http://localhost:3001/swf/ZeroClipboard.swf, I receive only No route matches [GET] "/swf/ZeroClipboard.swf"

Where should I put the library files to have the ability to access them directly?

Rails 4.2

  • They should be accessible through `/assets/*` use the `asset_path` rails helper. – DickieBoy Mar 19 '15 at 12:14
  • Ok, but how can I add a library to have the ability to access its files directly? – MildMildMint Mar 19 '15 at 12:18
  • I want to put 'http://localhost:3001/swf/ZeroClipboard.swf' in my browser and get ZeroClipboard.swf file. Where should I place it? – MildMildMint Mar 19 '15 at 12:21
  • Thats not how the asset pipeline works. I suggest [reading](http://guides.rubyonrails.org/asset_pipeline.html), Alternativly, `public/swf/` should work. – DickieBoy Mar 19 '15 at 12:23

1 Answers1

0

Image assets go in app/assets/images.

If you want to serve some assets from app/assets/img, you need to add that directory to config.assets.paths and then restart your server.

user229044
  • 232,980
  • 40
  • 330
  • 338