Sha256: fd55499921acea4ed11c8e6146a7bbd7f8e9dfa7c6d0f681d8f19bdc01597cf6

Contents?: true

Size: 385 Bytes

Versions: 13

Compression:

Stored size: 385 Bytes

Contents

# frozen_string_literal: true

module ActiveResource::Associations::Builder
  class BelongsTo < Association
    self.valid_options += [:foreign_key]

    self.macro = :belongs_to

    def build
      validate_options
      reflection = model.create_reflection(self.class.macro, name, options)
      model.defines_belongs_to_finder_method(reflection)
      reflection
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
activeresource-6.1.4 lib/active_resource/associations/builder/belongs_to.rb
activeresource-6.1.3 lib/active_resource/associations/builder/belongs_to.rb
activeresource-6.1.2 lib/active_resource/associations/builder/belongs_to.rb
activeresource-6.1.1 lib/active_resource/associations/builder/belongs_to.rb
activeresource-6.1.0 lib/active_resource/associations/builder/belongs_to.rb
ric-0.14.2 vendor/bundle/ruby/2.7.0/gems/activeresource-5.1.1/lib/active_resource/associations/builder/belongs_to.rb
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/activeresource-5.1.1/lib/active_resource/associations/builder/belongs_to.rb
activeresource-6.0.0 lib/active_resource/associations/builder/belongs_to.rb
ric-0.14.0 vendor/bundle/ruby/2.7.0/gems/activeresource-5.1.1/lib/active_resource/associations/builder/belongs_to.rb
activeresource-5.1.1 lib/active_resource/associations/builder/belongs_to.rb
ric-0.13.0 vendor/bundle/ruby/2.5.0/gems/activeresource-5.1.0/lib/active_resource/associations/builder/belongs_to.rb
ric-0.12.2 vendor/bundle/ruby/2.5.0/gems/activeresource-5.1.0/lib/active_resource/associations/builder/belongs_to.rb
activeresource-5.1.0 lib/active_resource/associations/builder/belongs_to.rb