Sha256: d2defaf0fca927fcf1e9ac04b7b77014bb97e4e9cebf6ab6a281d82ebc39004e
Contents?: true
Size: 692 Bytes
Versions: 15
Compression:
Stored size: 692 Bytes
Contents
module Noodall class Field include MongoMapper::EmbeddedDocument key :_type, String, :required => true key :name, String, :required => true key :label, String key :default, String key :required, Boolean, :default => false, :required => true embedded_in :form before_save :default_label def default_label self.label = self.name if self.label.blank? end def underscored_name name.parameterize.gsub('-','_').to_s end def default_class(response) 'default-value' if response.send(underscored_name.to_sym) == default end def mandatory? Form::MANDATORY_FIELDS.include?(self.name) end end end
Version data entries
15 entries across 15 versions & 1 rubygems