Sha256: 5c7fa1873df6935961f03803a62c5970f120bca0b450af892bb16a9437b120ef
Contents?: true
Size: 608 Bytes
Versions: 10
Compression:
Stored size: 608 Bytes
Contents
module JsonApiClient module Associations module BelongsTo extend ActiveSupport::Concern module ClassMethods def belongs_to(attr_name, options = {}) # self.associations = self.associations + [HasOne::Association.new(attr_name, self, options)] self.associations += [BelongsTo::Association.new(attr_name, self, options)] end end class Association < BaseAssociation def param :"#{attr_name}_id" end def to_prefix_path "#{attr_name.to_s.pluralize}/%{#{param}}" end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems