Class: Relationships::HasMany
- Inherits:
-
Relationship
- Object
- Relationship
- Relationships::HasMany
- Defined in:
- lib/active_mocker/active_record/relationships.rb
Instance Attribute Summary collapse
-
#klass_name ⇒ Object
readonly
Returns the value of attribute klass_name.
Attributes inherited from Relationship
Instance Method Summary collapse
- #foreign_key ⇒ Object
-
#initialize(name, klass_name, options = {}) ⇒ HasMany
constructor
A new instance of HasMany.
Methods inherited from Relationship
#class_name, #join_table, #options, #through
Constructor Details
#initialize(name, klass_name, options = {}) ⇒ HasMany
Returns a new instance of HasMany.
60 61 62 63 |
# File 'lib/active_mocker/active_record/relationships.rb', line 60 def initialize(name, klass_name, ={}) @klass_name = klass_name super(name, ) end |
Instance Attribute Details
#klass_name ⇒ Object (readonly)
Returns the value of attribute klass_name.
58 59 60 |
# File 'lib/active_mocker/active_record/relationships.rb', line 58 def klass_name @klass_name end |
Instance Method Details
#foreign_key ⇒ Object
65 66 67 |
# File 'lib/active_mocker/active_record/relationships.rb', line 65 def foreign_key [:foreign_key] || klass_name.to_s.foreign_key end |