Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From the meta_search gem page you can see that for boolean values the 'Wheres' are:</p> <ul> <li>is_true - Is true. Useful for a checkbox like “only show admin users”.</li> <li>is_false - The complement of is_true.</li> </ul> <p>so what you need is to change the generate input name from 'completed_eq' to be 'completed_is_true' or 'completed_is_false'. </p> <p>The only way I have found this possible to do is with Javascript, since by looking at the Active Admin code, the 'Wheres' are hardcoded for each data type.</p> <p>I would usually have a line like this in my activeadmin.js file (using jQuery)</p> <pre><code>$('#q_completed_eq').attr('name', 'q[completed_is_true]'); </code></pre> <p>or</p> <pre><code>$('#q_completed_eq').attr('name', 'q[completed_is_false]'); </code></pre> <p>Terrible and ugly hack but have found no other solution myself.</p> <p>Be careful to enable this only in the pages you want.</p> <p>--- NEW FOR VERSION 0.4.2 and newer ---</p> <p>Now Active Admin uses separate modules for each :as => ... option in the filters. So for example you can place the code below inside an initializer file </p> <pre><code>module ActiveAdmin module Inputs class FilterCustomBooleanInput &lt; ::Formtastic::Inputs::SelectInput include FilterBase def input_name "#{@method}_is_true" end def input_options super.merge(:include_blank =&gt; I18n.t('active_admin.any')) end def method super.to_s.sub(/_id$/,'').to_sym end def extra_input_html_options {} end end end end </code></pre> <p>and the use</p> <pre><code>:as =&gt; :custom_boolean </code></pre> <p>where you specify your filter.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload