In this post I’m going to cover how to get the full path url of an uploaded image using carrierwave gem.
By default carrierwave stores the uploaded images at /uploads/model_name/id/image.png
If you request the image url from the database it will only return the /uploads/model_name/id/image.jpg directory.
What if you need the full path ? Like: http://www.mysite.com/uploads/model_name/id/image.jpg
The only thing you need to do is to to set the asset_host in your development/production environment:
After that you need to restart your server and now you can get the full path of the image.
Feel free to ask questions and make suggestions 🙂
Thanks for reading this post, it is always a pleasure writing for you guys. If you like what you just read and somehow you want to support me, you can become a Patreon . Being my Patreon makes you get my private posts about programming with iOS and Ruby.
See you next time!