LoginSignup
8
9

More than 5 years have passed since last update.

Ransackで複数項目の検索ボックスを作成する

Posted at

Ransackで検索ボックスを作成する際のメモ

複数項目で検索する際は項目を_orで繋げればオッケー

ex.erb
<%= search_form_for(@q,url: "/", method: :get) do |f| %>
  <%= f.label :名前 %>
  <%= f.search_field :name_or_part_1_cont, class: "form-control", placeholder: "" %>

https://github.com/activerecord-hackery/ransack
に載ってますが、日本語での情報がなかったためメモさせていただきました。

8
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
9