module BabySqueel::Operators::ArelAliasing

Public Instance Methods

arel_alias(operator, arel_name) click to toggle source

Allows the creation of shorthands for Arel methods.

Arguments

  • operator - A custom operator.

  • arel_name - The name of the Arel method you want to alias.

Example

BabySqueel::Nodes::Node.arel_alias :unlike, :does_not_match
Post.where.has { title.unlike 'something' }
# File lib/baby_squeel/operators.rb, line 15
def arel_alias(operator, arel_name)
  define_method operator do |other|
    send(arel_name, other)
  end
end