开发者

Getting absolute path to the file inside the public folder in Rails

开发者 https://www.devze.com 2023-01-08 10:44 出处:网络
What is the best way to get absolute path to the file inside the public folder in controller? Is there a predefined Rails variable that holds absolute path to the public folder?

What is the best way to get absolute path to the file inside the public folder in controller? Is there a predefined Rails variable that holds absolute path to the public folder?

Currently I'm usin开发者_StackOverflow社区g File.expand_path('../../../public', __FILE__), but I'm sure there's a nicer way of doing this.


Rails.public_path should provide you the public path

0

精彩评论

暂无评论...
验证码 换一张
取 消