MetaSearch를 사용하여 검색 양식으로 필터링하려는 인덱스 페이지가 Users
입니다. 그러나 체크 박스를 클릭 할 때 검색하고자하는 값은 문자열로 저장됩니다.문자열에 대한 확인란에서 MetaSearch를 사용할 수 있습니까?
<% form_for(current_user.profile) do |f| %>
<table id="careerCriteria">
<tr>
<td class="normal"><%= current_user.profile.hometown %></td>
<td><%= check_box_tag :hometown %></td>
</tr>
<tr>
<td class="normal"><%= current_user.profile.current_city %></td>
<td><%= check_box_tag :current_city %></td>
</tr>
<tr>
<td class="normal"><%= current_user.profile.past_city %></td>
<td><%= check_box_tag :past_city %></td>
</tr>
</table>
<% end %>
내 사용자 모델 : 나는 검색 버튼을 사용하지 않으
class User < ActiveRecord::Base
has_one :profile, :dependent => :destroy
end
예를 들어, 나는 여기에 수 MetaSearch을 적용 할 양식입니다. 확인란 (또는 확인란)을 클릭하면 필터가 적용되기를 원합니다. 나는 프로그래밍에 익숙하지 않아 어떤 도움을 주시면 감사하겠습니다!
감사합니다.하지만 여러 검색어를 사용하여 검색하는 방법은 무엇입니까? 여러 다른 용어로 필터링 할 수있는 기회를 원합니다. 예 : 거주지, current_city, past_city. – tvalent2
모델에서 범위를 사용해야합니다. 개요를 제공하는 링크가 있습니다. 그것은 또한 당신이 찾고있는 것을 정확하게하는 방법을 보여줄 수있는 이점이 있습니다 : http://edgerails.info/articles/what-s-new-in-edge-rails/2010/02/23/the-skinny- on-scope-formerly-named-scope/index.html – Altonymous
지금까지 도움을 주셔서 감사합니다. 나는 이것에 단편적인 것들을 덧붙여서 또 다른 질문을 던졌다. 당신은 내 모습을보고 그것을 연결하는 방법을 알아낼 수 있습니까? http://stackoverflow.com/questions/7466123/form-filter-on-index-page-using-cross-model-scope – tvalent2