的信這是我的index.html.erb我從一個字母到z一個字符,我需要找到服務器上只是點擊字母
<% for char in 'A'..'Z' %>
<a href="/pacientes?char=<%= char%>"><%= char%></a>
<% end %>
這是我的控制器:
if params[:char].nil?
@pacientes = Paciente.all
elsif
@pacientes = Paciente.where("apellido1 = ?", @char = params[:char])
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @pacientes }
end
我需要的是當我在字母A的所有人都開始用字母A單擊,在這一刻我纔可以找到他們,如果對URL我把搜索
\t <%在 'A' 炭.. 'Z' %> \t <%= char%> \t <% end %>
– gfallasc那我的索引
\t <%在 'A' 炭.. 'Z' %> \t <%= char%> \t <% end %>
– gfallasc我可以在數據庫中找到我所擁有的,但我需要的是顯示所有以單擊字母開頭的人! – gfallasc