Sha256: 70041d52d3902e4999c7c37606ea8cb27e9339b017534c8261b923606c3bbcfe

Contents?: true

Size: 518 Bytes

Versions: 3

Compression:

Stored size: 518 Bytes

Contents

module JsonApiClient
  module Associations
    module BelongsTo
      class Association < BaseAssociation
        include Helpers::URI
        def param
          :"#{attr_name}_id"
        end

        def to_prefix_path(formatter)
          "#{formatter.format(attr_name.to_s.pluralize)}/%{#{param}}"
        end

        def set_prefix_path(attrs, formatter)
          attrs[param] = encode_part(attrs[param]) if attrs.key?(param)
          to_prefix_path(formatter) % attrs
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
json_api_client-1.6.4 lib/json_api_client/associations/belongs_to.rb
json_api_client-1.6.3 lib/json_api_client/associations/belongs_to.rb
json_api_client-1.6.2 lib/json_api_client/associations/belongs_to.rb