Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails - How to get file path (not url path) for assets?

I have a weekly generator that zips some files. Some are assets in app/assets/images/xxx.xxx some are uploaded via Paperclip and in public/system/env...

The file paths I have start after app, without /images/ or public.

I'll get something like /assets/some.png or /system/production/xyz/some.jpg, and these will be served fine as a URL path, but I want to collect them in a file.

How can I get the filepath of an asset?


I think this is an easier way to explain it.

Given the asset URI string, how can I find and get the asset's file path?

The asset URL path /assets/logo.png could be one of the files:

public/logo.png
public/assets/logo.png
app/assets/images/logo.png 
like image 445
Peter R Avatar asked Dec 14 '15 07:12

Peter R


1 Answers

In production, assets should be precompile and served from the public root folder /public/assets/logo.png

like image 193
Mike Avatar answered Oct 16 '22 14:10

Mike