Sha256: 795930cac0bc238510db364a79b0e9dc7688878b3c7f60f6a19b37962b6ecaf2

Contents?: true

Size: 576 Bytes

Versions: 2

Compression:

Stored size: 576 Bytes

Contents

# typed: true
# frozen_string_literal: true

begin
  require "active_record"
rescue LoadError
  return
end

module Tapioca
  module Dsl
    module Compilers
      module Extensions
        module ActiveRecord
          attr_reader :__tapioca_delegated_types

          def delegated_type(role, types:, **options)
            @__tapioca_delegated_types ||= {}
            @__tapioca_delegated_types[role] = { types: types, options: options }

            super
          end

          ::ActiveRecord::Base.singleton_class.prepend(self)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tapioca-0.10.5 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.10.4 lib/tapioca/dsl/extensions/active_record.rb