Class: Noodall::Field

Inherits:
Object
  • Object
show all
Includes:
MongoMapper::EmbeddedDocument
Defined in:
app/models/noodall/field.rb

Direct Known Subclasses

CheckBox, DateField, Multiselect, Select, TextField

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_labelObject



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

Returns:

  • (Boolean)


27
28
29
# File 'app/models/noodall/field.rb', line 27

def mandatory?
  Form::MANDATORY_FIELDS.include?(self.name)
end

#underscored_nameObject



19
20
21
# File 'app/models/noodall/field.rb', line 19

def underscored_name
  name.parameterize.gsub('-','_').to_s
end