Sha256: 2f225748de11dbc2d2cf287290a6c1195276a7784ecaf785a70650747899b847

Contents?: true

Size: 576 Bytes

Versions: 5

Compression:

Stored size: 576 Bytes

Contents

require 'active_support/concern'

module Ardm
  module Ar
    module StorageNames
      extend ActiveSupport::Concern

      module ClassMethods
        def storage_names
          Ardm::Ar::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

5 entries across 5 versions & 1 rubygems

Version Path
ardm-0.4.0.ar427 lib/ardm/ar/storage_names.rb
ardm-0.4.0 lib/ardm/ar/storage_names.rb
ardm-0.3.2 lib/ardm/ar/storage_names.rb
ardm-0.3.1 lib/ardm/ar/storage_names.rb
ardm-0.3.0 lib/ardm/ar/storage_names.rb