Sha256: 0a278d6e482aa5f64c0fb1d028c654c78d8c9d57de8a4e31cb7ae1fb27b363f8

Contents?: true

Size: 541 Bytes

Versions: 31

Compression:

Stored size: 541 Bytes

Contents

module JsonApiClient
  module Associations
    module HasOne
      extend ActiveSupport::Concern

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

      class Association < BaseAssociation
        def parse(params)
          params ? association_class.new(params) : nil
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
json_api_client-0.3.1 lib/json_api_client/associations/has_one.rb
json_api_client-0.3.0 lib/json_api_client/associations/has_one.rb
json_api_client-0.2.4 lib/json_api_client/associations/has_one.rb
json_api_client-0.2.3 lib/json_api_client/associations/has_one.rb
json_api_client-0.2.2 lib/json_api_client/associations/has_one.rb
json_api_client-0.2.1 lib/json_api_client/associations/has_one.rb
json_api_client-0.2.0 lib/json_api_client/associations/has_one.rb
json_api_client-0.1.3 lib/json_api_client/associations/has_one.rb
json_api_client-0.1.2 lib/json_api_client/associations/has_one.rb
json_api_client-0.1.1 lib/json_api_client/associations/has_one.rb
json_api_client-0.0.3 lib/json_api_client/associations/has_one.rb