Checkbox that will search DB for boolean - Rails 4
<p>I have a search form and I need a checkbox that will select and then return whether a particular listing allows pets. I have created a custom route, controller method, and erb in the view. However, I am not accomplishing what I set out to do.</p>

<p>When a user clicks the <code>Pets Allowed</code> checkbox and then clicks search, the listings where pets allowed == true should be returned. I am not sure how to go about that.</p>

<p>This is the current code, but does not accomplish what I am after. This will redirect to /pets_allowed but that isn't a real thing.</p>

<p>listings_controller:</p>

<pre><code>def pets_allowed
  @listings = Listing.where(pets: true)
end
</code></pre>

<p>routes.rb:</p>

<pre><code>get "pets_allowed" =&gt; "listings#pets_allowed"
</code></pre>

<p>html.erb:</p>

<pre><code>&lt;div&gt;
  &lt;%= link_to 'Pets Allowed', pets_allowed_path, :class =&gt; 'button btn-transparent' %&gt;
&lt;/div&gt;
</code></pre>