How can I use checkboxes to change the value of an attribute?

I am creating a Ruby on Rails application where it searches for certain classes according to their: model, session and year. Moreover, I need a check box to filter which class is being displayed on the screen.

The options include: VEX IQ and VRC. The way I was originally filtering this information was by doing the following:

<p><b> Saturday </b></p> 
<% Klass.where(days_of_week: 'Saturday', model: params[:chckBox], session: 'Spring', calendar_year: '2018').order('name asc').count('id') do |ksa| %>
   <li class="list"> <%= ksa.name %> </li>
<% end %> 

When I added a check box, I tried doing the following:

<%= check_box_tag(:chckBox)%>
<br>
<% if (params[:chckBox] == "true") %>
	<%= puts "Chceck box is checked" %>
<% elsif (params[:chckBox] == "false") %>
	<%= puts "Not checked" %>
<% end %>

I tried displaying the information to see what it would display, but it does not even do that. I need help haha. Please if you are able to understand what I am trying to do, just ask me again.

Thank you.

Unobtrusive JavaScript is likely what you’re looking for. You can have a link or checkbox to a partial web page update with it.

If you don’t want to hit the server to update the page you’ll need to use JavaScript to update the page client side when a checkbox is selected. How To - Toggle Hide and Show. This is more typical of filtering with checkboxes.