我有:
<a href="/patients/#{@appointment.patient.id}">
<%=h @appointment.patient.f_name %> <%=h @appointment.patient.l_name%>
</a>
Run Code Online (Sandbox Code Playgroud)
但由于语法错误,它不起作用,如果我点击href它去 http://0.0.0.0:3000/patients/#{@appointment.patient.id}
谢谢
Sha*_*ell 13
你可以做:
<a href="/patients/<%= @appointment.patient.id %>">
Run Code Online (Sandbox Code Playgroud)
但它通常更容易使用link_to:
link_to(@appointment.patient.f_name + " " + @appointment.patient.l_name,
:controller => 'patients', :action => 'show', :id => @appointment.patient.id)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16768 次 |
| 最近记录: |