Sha256: 26c4f5c86bba45a71bd90efbfff11f0a6337fee4408caae2e9384d4a21b1f02f

Contents?: true

Size: 1.19 KB

Versions: 18

Compression:

Stored size: 1.19 KB

Contents

# typed: true
# frozen_string_literal: true

begin
  require "active_support"
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

          attr_reader :__tapioca_secure_tokens

          def has_secure_token(attribute = :token, **)
            @__tapioca_secure_tokens ||= []
            @__tapioca_secure_tokens << attribute

            super
          end

          attr_reader :__tapioca_stored_attributes

          def store_accessor(store_attribute, *keys, prefix: nil, suffix: nil)
            @__tapioca_stored_attributes ||= []
            @__tapioca_stored_attributes << [store_attribute, keys, prefix, suffix]

            super
          end

          ::ActiveSupport.on_load(:active_record) do
            ::ActiveRecord::Base.singleton_class.prepend(::Tapioca::Dsl::Compilers::Extensions::ActiveRecord)
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
tapioca-0.16.8 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.16.7 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.16.6 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.16.5 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.16.4 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.16.3 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.16.2 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.16.1 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.16.0 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.15.1 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.15.0 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.14.4 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.14.3 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.13.3 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.13.2 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.13.1 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.13.0 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.12.0 lib/tapioca/dsl/extensions/active_record.rb