Sha256: 9c8f1053724372fd45738799f2bc376e010ab4475d9a957babcffc36c1d70e07

Contents?: true

Size: 470 Bytes

Versions: 31

Compression:

Stored size: 470 Bytes

Contents

module JsonApiClient
  module Associations
    module HasMany
      extend ActiveSupport::Concern

      module ClassMethods
        def has_many(attr_name, options = {})
          self.associations = self.associations + [HasMany::Association.new(attr_name, self, options)]
        end
      end

      class Association < BaseAssociation
        def parse(param)
          [param].flatten.map{|data| association_class.new(data) }
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
json_api_client-0.9.6 lib/json_api_client/associations/has_many.rb
json_api_client-0.9.5 lib/json_api_client/associations/has_many.rb
json_api_client-1.0.0.beta6 lib/json_api_client/associations/has_many.rb
json_api_client-0.9.4 lib/json_api_client/associations/has_many.rb
json_api_client-0.9.3 lib/json_api_client/associations/has_many.rb
json_api_client-1.0.0.beta5 lib/json_api_client/associations/has_many.rb
json_api_client-1.0.0.beta4 lib/json_api_client/associations/has_many.rb
json_api_client-0.9.2 lib/json_api_client/associations/has_many.rb
json_api_client-1.0.0.beta3 lib/json_api_client/associations/has_many.rb
json_api_client-1.0.0.beta2 lib/json_api_client/associations/has_many.rb
json_api_client-0.9.0 lib/json_api_client/associations/has_many.rb
json_api_client-1.0.0.beta lib/json_api_client/associations/has_many.rb
json_api_client-0.8.1 lib/json_api_client/associations/has_many.rb
json_api_client-0.8.0 lib/json_api_client/associations/has_many.rb
json_api_client-0.7.1 lib/json_api_client/associations/has_many.rb
json_api_client-0.7.0 lib/json_api_client/associations/has_many.rb
json_api_client-0.6.0 lib/json_api_client/associations/has_many.rb
json_api_client-0.5.1 lib/json_api_client/associations/has_many.rb
json_api_client-0.5.0 lib/json_api_client/associations/has_many.rb
json_api_client-0.4.0 lib/json_api_client/associations/has_many.rb