Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails access folder in public folder

I have such structure(for example):

 public
   art_im
     folder1
        img01.jpg

what i need to write, to access this img01.jpg in tag? i try

= image_tag("#{Rails.root}/public/art_im/images_#{@graphics.id}/#{@grp.id}.jpg", :alt => "#{@art.nr}")

but i get in html <img alt="lalala" src="/home/prog/project/Shop/public/art_im/images_32/214800.jpg">

but how to link on my server, and get this images?

like image 770
brabertaser19 Avatar asked Feb 22 '13 11:02

brabertaser19


1 Answers

When your app is run by webserver, its webroot will be the public directory. So, this should work:

= image_tag("/art_im/images_#{@graphics.id}/#{@grp.id}.jpg", :alt => "#{@art.nr}")
like image 79
Sergio Tulentsev Avatar answered Oct 22 '22 22:10

Sergio Tulentsev