Sha256: 7c7171ff7dccf95148e6909055f478d12c2db73753b15048ef65433db30d742d

Contents?: true

Size: 423 Bytes

Versions: 15

Compression:

Stored size: 423 Bytes

Contents

module JsonApiClient
  module Associations
    module HasOne
      extend ActiveSupport::Concern

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

      class Association < BaseAssociation
        def from_result_set(result_set)
          result_set.first
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
json_api_client-1.6.1 lib/json_api_client/associations/has_one.rb
json_api_client-1.6.0 lib/json_api_client/associations/has_one.rb
json_api_client-1.5.3 lib/json_api_client/associations/has_one.rb
json_api_client-1.5.2 lib/json_api_client/associations/has_one.rb
json_api_client-1.5.1 lib/json_api_client/associations/has_one.rb
json_api_client-1.5.0 lib/json_api_client/associations/has_one.rb
json_api_client-1.4.0 lib/json_api_client/associations/has_one.rb
json_api_client-1.3.0 lib/json_api_client/associations/has_one.rb
json_api_client-1.2.0 lib/json_api_client/associations/has_one.rb
json_api_client-1.1.1 lib/json_api_client/associations/has_one.rb
json_api_client-1.1.0 lib/json_api_client/associations/has_one.rb
json_api_client-1.0.2 lib/json_api_client/associations/has_one.rb
json_api_client-1.0.1 lib/json_api_client/associations/has_one.rb
json_api_client-1.0.0 lib/json_api_client/associations/has_one.rb
json_api_client-1.0.0.beta7 lib/json_api_client/associations/has_one.rb