class Presentation::Form::Field

Attributes

label[W]
name[RW]

the parameter name of the field

type[W]
type_options[RW]

unrestricted options storage for the widget type. this could be a list of options for a select, or extra configuration for a calendar widget.

value[W]

Public Instance Methods

label() click to toggle source

the display label of the field

# File lib/presentation/form.rb, line 107
def label
  @label ||= name.to_s.titleize
end
type() click to toggle source

the widget type for the field. use type_options to pass arguments to the widget.

# File lib/presentation/form.rb, line 136
def type
  @type ||= :string
end
value() click to toggle source

where the value for this field comes from.

  • String: a fixed value

  • Symbol: a method on the record (no arguments)

  • Proc: a custom block that accepts the record as an argument

# File lib/presentation/form.rb, line 119
def value
  @value ||= name.to_sym
end