From ac12d19248e2846bec5e8fe4a5f80ebc724ff8e6 Mon Sep 17 00:00:00 2001 From: Adam Rice Date: Mon, 22 Aug 2016 10:20:02 +1000 Subject: [PATCH] Support empty and not empty on boolean fields incase they are ever added to the UI --- lib/rails_admin/adapters/active_record.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/rails_admin/adapters/active_record.rb b/lib/rails_admin/adapters/active_record.rb index 6260990e73..27baec8088 100644 --- a/lib/rails_admin/adapters/active_record.rb +++ b/lib/rails_admin/adapters/active_record.rb @@ -172,14 +172,16 @@ def generic_unary_operators '_null' => ["(#{@column} IS NULL)"], '_not_null' => ["(#{@column} IS NOT NULL)"], '_empty' => ["(#{@column} = '')"], - '_not_empty' => ["(#{@column} != '')"] + '_not_empty' => ["(#{@column} != '')"], } end def boolean_unary_operators generic_unary_operators.merge( '_blank' => ["(#{@column} IS NULL)"], - '_present' => ["(#{@column} IS NOT NULL)"] + '_empty' => ["(#{@column} IS NULL)"], + '_present' => ["(#{@column} IS NOT NULL)"], + '_not_empty' => ["(#{@column} IS NOT NULL)"], ) end