You can do:
<a href="/patients/<%= @appointment.patient.id %>">
But it's usually easier to use link_to :
link_to(@appointment.patient.f_name + " " + @appointment.patient.l_name, :controller => 'patients', :action => 'show', :id => @appointment.patient.id)
source share