Sha256: f517769e2a1ab928d2345fbb1fd7f20ee02f97ef7daf79b1e0d6ec75d0e165e9

Contents?: true

Size: 948 Bytes

Versions: 2

Compression:

Stored size: 948 Bytes

Contents

require 'active_force/association/association'
require 'active_force/association/eager_load_projection_builder'
require 'active_force/association/relation_model_builder'
require 'active_force/association/has_many_association'
require 'active_force/association/has_one_association'
require 'active_force/association/belongs_to_association'

module ActiveForce
  module Association
    def associations
      @associations ||= {}
    end

    def find_association name
      associations[name.to_sym]
    end

    def has_many relation_name, options = {}
      associations[relation_name] = HasManyAssociation.new(self, relation_name, options)
    end

    def has_one relation_name, options = {}
      associations[relation_name] = HasOneAssociation.new(self, relation_name, options)
    end

    def belongs_to relation_name, options = {}
      associations[relation_name] = BelongsToAssociation.new(self, relation_name, options)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_force-0.15.1 lib/active_force/association.rb
active_force-0.15.0 lib/active_force/association.rb