Module: ArelExtensions::NullFunctions

Included in:
Arel::Nodes::Function, Arel::Nodes::Grouping, Attributes, ArelExtensions::Nodes::Case
Defined in:
lib/arel_extensions/null_functions.rb

Instance Method Summary collapse

Instance Method Details

#coalesce(*args) ⇒ Object

returns the first non-null expr in the expression list. You must specify at least two expressions. If all occurrences of expr evaluate to null, then the function returns null.



18
19
20
21
# File 'lib/arel_extensions/null_functions.rb', line 18

def coalesce *args
  args.unshift(self)
  ArelExtensions::Nodes::Coalesce.new args
end

#is_not_nullObject

ISNOTNULL function lets you return an alternative value when an expression is NOT NULL.



12
13
14
# File 'lib/arel_extensions/null_functions.rb', line 12

def is_not_null
  ArelExtensions::Nodes::IsNotNull.new [self]
end

#is_nullObject

ISNULL function lets you return an alternative value when an expression is NULL.



7
8
9
# File 'lib/arel_extensions/null_functions.rb', line 7

def is_null
  ArelExtensions::Nodes::IsNull.new [self]
end