Sha256: 7755fbdea3869dfe9ed03263b3e05e2179d26e1dfa20e2c94da441fbce930eb0

Contents?: true

Size: 307 Bytes

Versions: 24

Compression:

Stored size: 307 Bytes

Contents

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

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
spyke-1.8.7 lib/spyke/associations/belongs_to.rb
spyke-1.8.6 lib/spyke/associations/belongs_to.rb
spyke-1.8.5 lib/spyke/associations/belongs_to.rb
spyke-1.8.4 lib/spyke/associations/belongs_to.rb
spyke-1.8.3 lib/spyke/associations/belongs_to.rb
spyke-1.8.2 lib/spyke/associations/belongs_to.rb
spyke-1.8.1 lib/spyke/associations/belongs_to.rb
spyke-1.8.0 lib/spyke/associations/belongs_to.rb
spyke-1.7.2 lib/spyke/associations/belongs_to.rb
spyke-1.7.1 lib/spyke/associations/belongs_to.rb
spyke-1.7.0 lib/spyke/associations/belongs_to.rb
spyke-1.6.0 lib/spyke/associations/belongs_to.rb
spyke-1.5.0 lib/spyke/associations/belongs_to.rb
spyke-1.4.1 lib/spyke/associations/belongs_to.rb
spyke-1.4.0 lib/spyke/associations/belongs_to.rb
spyke-1.3.0 lib/spyke/associations/belongs_to.rb
spyke-1.2.1 lib/spyke/associations/belongs_to.rb
spyke-1.2.0 lib/spyke/associations/belongs_to.rb
spyke-1.1.2 lib/spyke/associations/belongs_to.rb
spyke-1.1.1 lib/spyke/associations/belongs_to.rb