relative path issue (noob)
- by tim roberts
I am using the following code to check existence of a file before publishing an image in my erb file.
<% @imagename = @place.name + ".jpg" %>
<% if FileTest.exist?( "/Users/Tim/projects/game/public/" + @imagename ) %>
<p><img src= '<%= @imagename %>' width="400" height="300" /> </p>
<% end %>
And when I publish this to Heroku, it obviously wont work.
I tried using a relative path, but not able to get it to work.
<% if FileTest.exist?( "/" + @imagename ) %
any help appreciated.