Trip Trip - 10 months ago 37
Ruby Question

How do you access your images folder from a controller?

I'm setting up Prawn right now and for one param it wants to know the img location.

In their case they wrote :

img = "#{Prawn::BASEDIR}/data/images/card_cutout.jpg"

But that points to a local gems folder. How can I make this from the controller point to
in my public/images/ folder.

I tried using an absolute link thinking it would work like a website but I was wrong :

img = "

Thanks in advance!


Try this:

img = "#{Rails.root/public/images/card_cutout.jpg}"