Sha256: a030a1e3f462819c4c405fa47b029835165dff98b9adec6af2e0eb23e1587682

Contents?: true

Size: 596 Bytes

Versions: 10

Compression:

Stored size: 596 Bytes

Contents

require 'active_support/concern'

module Ardm
  module ActiveRecord
    module StorageNames
      extend ActiveSupport::Concern

      module ClassMethods
        def storage_names
          Ardm::ActiveRecord::StorageNames::Proxy.new(self)
        end
      end

      class Proxy
        def initialize(model)
          @model = model
        end

        def []=(repo, table_name)
          unless repo == :default
            raise ArgumentError, "repositories other than :default not supported."
          end
          @model.table_name = table_name
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ardm-0.2.7 lib/ardm/active_record/storage_names.rb
ardm-0.2.6 lib/ardm/active_record/storage_names.rb
ardm-0.2.5 lib/ardm/active_record/storage_names.rb
ardm-0.2.4 lib/ardm/active_record/storage_names.rb
ardm-0.2.3 lib/ardm/active_record/storage_names.rb
ardm-0.2.2 lib/ardm/active_record/storage_names.rb
ardm-0.2.1 lib/ardm/active_record/storage_names.rb
ardm-0.2.0 lib/ardm/active_record/storage_names.rb
ardm-0.1.0 lib/ardm/active_record/storage_names.rb
ardm-0.0.1 lib/ardm/active_record/storage_names.rb