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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -