Module: ArelExtensions::NullFunctions

Included in:
Attributes
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.



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

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.



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

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.



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

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