Sha256: 860769c032c79a892d26ee692b9dbb83c8f069d2256c408c69e8fed58c837438

Contents?: true

Size: 985 Bytes

Versions: 4

Compression:

Stored size: 985 Bytes

Contents

require 'syncano/active_record/scope_builder'

class Syncano
  module ActiveRecord
    # Module with associations functionality for Syncano::ActiveRecord
    module Association
      # Base class for all associations
      class Base
        # Constructor for association
        # @param [Class] source_model
        # @param [Symbol] name
        def initialize(source_model, name)
          self.source_model = source_model
          self.associated_model = name.to_s.classify.constantize
          self.foreign_key = source_model.name.foreign_key
        end

        # Checks if association is belongs_to type
        # @return [FalseClass]
        def belongs_to?
          false
        end

        # Checks if association is has_one type
        # @return [FalseClass]
        def has_one?
          false
        end

        # Checks if association is has_many type
        # @return [FalseClass]
        def has_many?
          false
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
syncano-3.1.4 lib/syncano/active_record/association/base.rb
syncano-3.1.3 lib/syncano/active_record/association/base.rb
syncano-3.1.2 lib/syncano/active_record/association/base.rb
syncano-3.1.1 lib/syncano/active_record/association/base.rb