Class: ActiveMocker::ActiveRecord::Relationships::HasMany Private

Inherits:
Relationship
  • Object
show all
Defined in:
lib/active_mocker/active_record/relationships.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Attributes inherited from Relationship

#name

Instance Method Summary collapse

Methods inherited from Relationship

#class_name, #join_table, #options, #through

Constructor Details

#initialize(name, klass_name, options = {}) ⇒ HasMany

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of HasMany.



64
65
66
67
# File 'lib/active_mocker/active_record/relationships.rb', line 64

def initialize(name, klass_name, options={})
  @klass_name = klass_name
  super(name, options)
end

Instance Attribute Details

#klass_nameObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



62
63
64
# File 'lib/active_mocker/active_record/relationships.rb', line 62

def klass_name
  @klass_name
end

Instance Method Details

#foreign_keyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



69
70
71
# File 'lib/active_mocker/active_record/relationships.rb', line 69

def foreign_key
  options[:foreign_key] || klass_name.to_s.foreign_key
end