Sha256: 40a016a51dda9ebb63a71f204604493c287d2cc24ed7f5180a02802779cd779b

Contents?: true

Size: 624 Bytes

Versions: 2

Compression:

Stored size: 624 Bytes

Contents

# frozen_string_literal: true

module AR
  module UUID
    module TableDefinition
      def references(*args)
        options = args.extract_options!
        options[:type] = :uuid unless options.include?(:type)

        unless options.include?(:null)
          options[:null] =
            !::AR::UUID::Utils.belongs_to_required_by_default
        end

        super(*args, **options)
      end
      alias belongs_to references

      def primary_key(name, type = :primary_key, **options)
        options[:default] = ::AR::UUID::Utils.uuid_default_function
        super(name, type, **options)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ar-uuid-0.2.3 lib/ar/uuid/table_definition.rb
ar-uuid-0.2.2 lib/ar/uuid/table_definition.rb