<% if logged_in? -%>
<% if not @current_user.rentals.detect {|rental| rental.title.name == @title.name} -%>
<%= link_to "Rent Now!", :controller => 'account', :action => 'add_title', :id => @title.id %>
<% else -%>
!! You have already rented this title, it is due back in on <%= @current_user.rentals.title %>.
<% end -%>
<% else -%>
If you were logged in, you could rent this instantly!
<%= link_to "Register Now!", :controller => 'account', :action => 'register' %>
<% end -%>