module ArelExtensions::NullFunctions

Public Instance Methods

coalesce(*args) click to toggle source

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.

# File lib/arel_extensions/null_functions.rb, line 18
def coalesce *args
  args.unshift(self)
  ArelExtensions::Nodes::Coalesce.new args
end
is_not_null() click to toggle source

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

# File lib/arel_extensions/null_functions.rb, line 12
def is_not_null
  ArelExtensions::Nodes::IsNotNull.new [self]
end
is_null() click to toggle source

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

# File lib/arel_extensions/null_functions.rb, line 7
def is_null
  ArelExtensions::Nodes::IsNull.new [self]
end