Sha256: fce33931d128ea8881375ed719a778e7f539b75c066274df50b9d67b83281039
Contents?: true
Size: 620 Bytes
Versions: 11
Compression:
Stored size: 620 Bytes
Contents
module JsonApiClient module Associations class BaseAssociation attr_reader :attr_name, :klass, :options def initialize(attr_name, klass, options = {}) @attr_name = attr_name @klass = klass @options = options end def association_class @association_class ||= Utils.compute_type(klass, options.fetch(:class_name) do attr_name.to_s.classify end) end def data(url) from_result_set(association_class.requestor.linked(url)) end def from_result_set(result_set) result_set.to_a end end end end
Version data entries
11 entries across 11 versions & 1 rubygems