Class: DynamicFieldsets::FieldRecord
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- DynamicFieldsets::FieldRecord
- Defined in:
- app/models/dynamic_fieldsets/field_record.rb
Overview
Stores a single record’s answer to a field in a fieldset Fields with multiple answers should have multiple records in this model
Instance Method Summary collapse
-
#field ⇒ Field
A record can only be associated with Field children.
-
#type_of_fieldset_child ⇒ Object
make sure the fieldset child has the type field does not explicitly check to make sure the fieldset_child exists, still have to validate presence.
Instance Method Details
#field ⇒ Field
A record can only be associated with Field children
25 26 27 |
# File 'app/models/dynamic_fieldsets/field_record.rb', line 25 def field self.fieldset_child.child end |
#type_of_fieldset_child ⇒ Object
make sure the fieldset child has the type field does not explicitly check to make sure the fieldset_child exists, still have to validate presence
16 17 18 19 20 21 |
# File 'app/models/dynamic_fieldsets/field_record.rb', line 16 def type_of_fieldset_child # yet another casualty of me not understanding how the objects are getting duplicated in development (JH 3-6-2012) if self.fieldset_child && !self.fieldset_child.child.class.superclass.to_s.eql?("DynamicFieldsets::Field") self.errors.add(:fieldset_child, "The fieldset child must refer to a Field object") end end |