Class: Noodall::Field
- Inherits:
-
Object
show all
- Includes:
- MongoMapper::EmbeddedDocument
- Defined in:
- app/models/noodall/field.rb
Instance Method Summary
collapse
Instance Method Details
#default_class(response) ⇒ Object
23
24
25
|
# File 'app/models/noodall/field.rb', line 23
def default_class(response)
'default-value' if response.send(underscored_name.to_sym) == default
end
|
#default_label ⇒ Object
15
16
17
|
# File 'app/models/noodall/field.rb', line 15
def default_label
self.label = self.name if self.label.blank?
end
|
#mandatory? ⇒ Boolean
27
28
29
|
# File 'app/models/noodall/field.rb', line 27
def mandatory?
Form::MANDATORY_FIELDS.include?(self.name)
end
|
#underscored_name ⇒ Object
19
20
21
|
# File 'app/models/noodall/field.rb', line 19
def underscored_name
name.parameterize.gsub('-','_').to_s
end
|