Class: SampleModels::AttributeSequence::SecondPassBelongsToSource
- Inherits:
-
AbstractSource
- Object
- AbstractSource
- SampleModels::AttributeSequence::SecondPassBelongsToSource
- Defined in:
- lib/sample_models/attribute_sequence.rb
Instance Method Summary collapse
-
#initialize(model, assoc) ⇒ SecondPassBelongsToSource
constructor
A new instance of SecondPassBelongsToSource.
- #value ⇒ Object
Methods inherited from AbstractSource
Constructor Details
#initialize(model, assoc) ⇒ SecondPassBelongsToSource
Returns a new instance of SecondPassBelongsToSource.
137 138 139 140 |
# File 'lib/sample_models/attribute_sequence.rb', line 137 def initialize(model, assoc) super() @model, @assoc = model, assoc end |
Instance Method Details
#value ⇒ Object
142 143 144 145 146 147 148 |
# File 'lib/sample_models/attribute_sequence.rb', line 142 def value assoc_klass = @assoc.klass unless assoc_klass == @model.ar_class record = (assoc_klass.last || assoc_klass.sample) record.id end end |