Sha256: 7775a31cd01579d83c4716b62760fd3b26c8bc136af2e6704d894d42bf23bf92

Contents?: true

Size: 304 Bytes

Versions: 2

Compression:

Stored size: 304 Bytes

Contents

module Spyke
  module Associations
    class BelongsTo < Association
      def initialize(*args)
        super
        @options.reverse_merge!(uri: "/#{@name.to_s.pluralize}/:id", foreign_key: "#{klass.model_name.param_key}_id")
        @params[:id] = parent.try(foreign_key)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spyke-1.8.9 lib/spyke/associations/belongs_to.rb
spyke-1.8.8 lib/spyke/associations/belongs_to.rb