class Forma::SimpleField

SimpleField gets it's value from it's name.

Public Class Methods

new(h = {}) click to toggle source
Calls superclass method Forma::Field::new
# File lib/forma/field.rb, line 242
def initialize(h = {})
  h = h.symbolize_keys
  super(h)
end

Public Instance Methods

errors() click to toggle source
# File lib/forma/field.rb, line 254
def errors
  if self.model.respond_to?(:errors); self.model.errors.messages[name.to_sym] end || []
end
has_errors?() click to toggle source
# File lib/forma/field.rb, line 258
def has_errors?
  errors.any?
end
value() click to toggle source
Calls superclass method
# File lib/forma/field.rb, line 247
def value
  val = super
  if val then val
  else extract_value(self.model, self.name)
  end
end