Sha256: 6ffe513e3a41c0d89f16fcf9a1d28efd55f1f88a72eedb5a298ef5d39e681a92

Contents?: true

Size: 589 Bytes

Versions: 22

Compression:

Stored size: 589 Bytes

Contents

module ApiResource
  module AssociationActivation
    extend ActiveSupport::Concern
    
    included do
      class_attribute :association_types
      # our default association types
      self.association_types = {
        :belongs_to => :belongs_to_remote, 
        :has_one => :has_one_remote, 
        :has_many => :has_many_remote
      }
    end
    
    module ClassMethods
      def activate_associations(assoc_types = nil)
        self.association_types = assoc_types unless assoc_types.nil?
        self.send(:include, ApiResource::Associations)
      end
    end
    
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
api_resource-0.6.25 lib/api_resource/association_activation.rb
api_resource-0.6.24 lib/api_resource/association_activation.rb
api_resource-0.6.23 lib/api_resource/association_activation.rb
api_resource-0.6.22 lib/api_resource/association_activation.rb
api_resource-0.6.21 lib/api_resource/association_activation.rb
api_resource-0.6.20 lib/api_resource/association_activation.rb
api_resource-0.6.19 lib/api_resource/association_activation.rb
api_resource-0.6.18 lib/api_resource/association_activation.rb
api_resource-0.6.17 lib/api_resource/association_activation.rb
api_resource-0.6.16 lib/api_resource/association_activation.rb
api_resource-0.6.15 lib/api_resource/association_activation.rb
api_resource-0.6.14 lib/api_resource/association_activation.rb
api_resource-0.6.13 lib/api_resource/association_activation.rb
api_resource-0.6.12 lib/api_resource/association_activation.rb
api_resource-0.6.11 lib/api_resource/association_activation.rb
api_resource-0.6.9 lib/api_resource/association_activation.rb
api_resource-0.6.10 lib/api_resource/association_activation.rb
api_resource-0.6.8 lib/api_resource/association_activation.rb
api_resource-0.6.7 lib/api_resource/association_activation.rb
api_resource-0.6.6 lib/api_resource/association_activation.rb