Sha256: f78f38d3d450d31de4ab9270421631343114154c935e40560f7e0d4b00d91fa8

Contents?: true

Size: 481 Bytes

Versions: 1

Compression:

Stored size: 481 Bytes

Contents

module Rein
  module Constraint
    # This module defines methods for handling options command to several constraints.
    module Options
      def conditions_with_if(conditions, options = {})
        if options[:if].present?
          "NOT (#{options[:if]}) OR (#{conditions})"
        else
          conditions
        end
      end

      def constraint_name(table, attribute, options = {})
        options[:name].presence || "#{table}_#{attribute}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rein-2.1.0 lib/rein/constraint/options.rb