Determining if image exists in Rails 2 -
i trying check if file exists can either display image or placeholder placeholder shown. if conditional statement removed logo displayed fine.
<% if file.exists?(rails.root + '/public/images/portal/logos/' + @organisation_id + '.png') %> <img src="/images/portal/logos/<%= @organisation_id %>.png" alt="<%= @person.organisation.name %>"> <% else %> <img src="http://placehold.it/300x83&text=please+upload+your+company+logo"> <% end %>
i've read few questions seem relate rails 3 seeing don't errors thought work.
rails.root
working in rails 2? may rails_root
Comments
Post a Comment