Я использую метод select
и хочу выбрать несколько столбцов. Он работает с 2 столбцами, но не работает. Как я могу это исправить? Код в модели.
users = User.select(first_name, middle_name, last_name, email, position,
gender, address, sss_number, tin_number, phil_health, emergency_name,
emergency_contact, birthdate, date_hired, department) if (first_name || last_name || position ||
gender || address || sss_number || tin_number || phil_health || emergency_name ||
emergency_contact || birthdate || department).present?
return users
форма
<%= form_for @filter do |f| %>
<h3><i>Please select a column to filter</i></h3>
<div class="field">
<%= f.check_box :first_name, {}, "first_name" %>
<%= f.label "First Name" %>
</div>
<div class="field">
<%= f.check_box :middle_name, {}, "middle_name" %>
<%= f.label "Middle Name" %>
</div>
<div class="field">
<%= f.check_box :last_name, {}, "last_name" %>
<%= f.label "Last Name" %>
</div>
<div class="field">
<%= f.check_box :email, {}, "email" %>
<%= f.label "Email" %>
</div>
<div class="field">
<%= f.check_box :position, {}, "position" %>
<%= f.label "Position" %>
</div>
<div class="field">
<%= f.check_box :gender, {}, "gender" %>
<%= f.label "Gender" %>
</div>
<div class="field">
<%= f.check_box :address, {}, "address" %>
<%= f.label "Address" %>
</div>
<div class="field">
<%= f.check_box :sss_number, {}, "sss_number" %>
<%= f.label "SSS Number" %>
</div>
<div class="field">
<%= f.check_box :tin_number, {}, "tin_number" %>
<%= f.label "Tin Number" %>
</div>
<div class="field">
<%= f.check_box :phil_health, {}, "phil_health" %>
<%= f.label "Phil Health" %>
</div>
<div class="field">
<%= f.check_box :emergency_name, {}, "emergency_name" %>
<%= f.label "Emergency Name" %>
</div>
<div class="field">
<%= f.check_box :emergency_contact, {}, "emergency_contact" %>
<%= f.label "Emergency Contact" %>
</div>
<div class="field">
<%= f.check_box :birthdate, {}, "birthdate" %>
<%= f.label "Birthdate" %>
</div>
<div class="field">
<%= f.check_box :date_hired, {}, "date_hired" %>
<%= f.label "Date Hired" %>
</div>
<div class="field">
<%= f.check_box :department, {}, "department" %>
<%= f.label "Department" %>
</div>
<br>
<div class="actions">
<%= f.submit "Filter" %>
</div>
<% end %>