Module: DatastaxRails::Associations::ClassMethods

Defined in:
lib/datastax_rails/associations.rb

Overview

rubocop:disable Style/Documentation

Instance Method Summary collapse

Instance Method Details

#belongs_to(name, options = {}) ⇒ Object


66
67
68
# File 'lib/datastax_rails/associations.rb', line 66

def belongs_to(name, options = {})
  Builder::BelongsTo.build(self, name, options)
end

#has_and_belongs_to_many(_name, _options = {}) ⇒ Object


81
82
# File 'lib/datastax_rails/associations.rb', line 81

def has_and_belongs_to_many(_name, _options = {})
end

#has_many(name, options = {}) ⇒ Object


70
71
72
73
74
75
76
77
78
79
# File 'lib/datastax_rails/associations.rb', line 70

def has_many(name, options = {})
  Builder::HasMany.build(self, name, options)
  # klass = options[:class_name]
  # klass ||= name.to_s.singularize
  # foreign_key = options[:foreign_key]
  # foreign_key ||= self.name.foreign_key
  # define_method name do
  # klass.where(foreign_key)
  # end
end

#has_one(name, options = {}) ⇒ Object


84
85
86
# File 'lib/datastax_rails/associations.rb', line 84

def has_one(name, options = {})
  Builder::HasOne.build(self, name, options)
end