Skip to content

Commit

Permalink
Support empty and not empty on boolean fields incase they are ever ad…
Browse files Browse the repository at this point in the history
…ded to the UI
  • Loading branch information
Adam Rice authored and Adam Rice committed Aug 22, 2016
1 parent f8e826d commit ac12d19
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/rails_admin/adapters/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ac12d19

Please sign in to comment.