lib/searchlogic/condition/blank.rb in searchlogic-1.6.4 vs lib/searchlogic/condition/blank.rb in searchlogic-1.6.5
- old
+ new
@@ -8,13 +8,16 @@
super + ["is_blank"]
end
end
def to_conditions(value)
- if value == true
- "(#{column_sql} IS NULL or #{column_sql} = '' or #{column_sql} = false)"
- elsif value == false
- "(#{column_sql} IS NOT NULL and #{column_sql} != '' and #{column_sql} != false)"
+ case column.type
+ when :boolean
+ return "(#{column_sql} IS NULL or #{column_sql} = '' or #{column_sql} = false)" if value == true
+ return "(#{column_sql} IS NOT NULL and #{column_sql} != '' and #{column_sql} != false)" if value == false
+ else
+ return "(#{column_sql} IS NULL or #{column_sql} = '')" if value == true
+ return "(#{column_sql} IS NOT NULL and #{column_sql} != '')" if value == false
end
end
end
end
end
\ No newline at end of file