Skip to content

Commit

Permalink
Fix incorrect indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Rice authored and Adam Rice committed Jul 29, 2016
1 parent 39ef132 commit 3dc5013
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions lib/rails_admin/adapters/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,40 +152,40 @@ def build_statement(column, type, value, operator)
end

class StatementBuilder < RailsAdmin::AbstractModel::StatementBuilder
protected
protected

def unary_operators
case @type
when :boolean
boolean_unary_operators
else
generic_unary_operators
end
def unary_operators
case @type
when :boolean
boolean_unary_operators
else
generic_unary_operators
end
end

private
private

def generic_unary_operators
{
'_blank' => ["(#{@column} IS NULL OR #{@column} = '')"],
'_present' => ["(#{@column} IS NOT NULL AND #{@column} != '')"],
'_null' => ["(#{@column} IS NULL)"],
'_not_null' => ["(#{@column} IS NOT NULL)"],
'_empty' => ["(#{@column} = '')"],
'_not_empty' => ["(#{@column} != '')"]
}
end

def generic_unary_operators
def boolean_unary_operators
generic_unary_operators.merge(
{
'_blank' => ["(#{@column} IS NULL OR #{@column} = '')"],
'_present' => ["(#{@column} IS NOT NULL AND #{@column} != '')"],
'_null' => ["(#{@column} IS NULL)"],
'_not_null' => ["(#{@column} IS NOT NULL)"],
'_empty' => ["(#{@column} = '')"],
'_not_empty' => ["(#{@column} != '')"]
'_blank' => ["(#{@column} IS NULL)"],
'_present' => ["(#{@column} IS NOT NULL)"]
}
end

def boolean_unary_operators
generic_unary_operators.merge(
{
'_blank' => ["(#{@column} IS NULL)"],
'_present' => ["(#{@column} IS NOT NULL)"]
}
)
end
)
end

def range_filter(min, max)
def range_filter(min, max)
if min && max
["(#{@column} BETWEEN ? AND ?)", min, max]
elsif min
Expand Down

0 comments on commit 3dc5013

Please sign in to comment.