Sha256: 907c6d91c32cb60031b421bfa218b565406ae7d1a0f5844c2ea113f2936ecd0c

Contents?: true

Size: 303 Bytes

Versions: 3

Compression:

Stored size: 303 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

3 entries across 3 versions & 1 rubygems

Version Path
spyke-2.0.0 lib/spyke/associations/belongs_to.rb
spyke-1.8.11 lib/spyke/associations/belongs_to.rb
spyke-1.8.10 lib/spyke/associations/belongs_to.rb