Sha256: 2c4485f79a5d37783367bdecded275a0c339c8e800ab9c780554327b86273031

Contents?: true

Size: 590 Bytes

Versions: 35

Compression:

Stored size: 590 Bytes

Contents

# frozen_string_literal: true

module LinkedRails
  module Model
    module Tables
      extend ActiveSupport::Concern

      included do
        class_attribute :defined_columns
      end

      module ClassMethods
        def with_columns(opts)
          initialize_columns
          defined_columns.merge!(opts)
        end

        def initialize_columns
          return if defined_columns && method(:defined_columns).owner == singleton_class

          self.defined_columns = superclass.try(:defined_columns)&.dup || {}.with_indifferent_access
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
linked_rails-0.0.4.pre.g3aeec2263 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.gacd5f04d4 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.gb0b6aea40 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.g792a1b887 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.g58af47992 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.g0ec6e30ca lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.g9e3bcac55 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.g222bfeeca lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.gb254a2893 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.g2c6c26e86 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.ge881247c3 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.gfabf7e9f5 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.g8c045be3a lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.g8d7195543 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.gfe77aae19 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.gc866c1806 lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.g3e8f5731a lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.g58e27be7f lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.g96885856b lib/linked_rails/model/tables.rb
linked_rails-0.0.4.pre.g1faca9643 lib/linked_rails/model/tables.rb