Class: Group

Inherits:
BasicField show all
Defined in:
lib/formalize/field.rb

Direct Known Subclasses

CheckboxGroup, RadioGroup

Instance Method Summary collapse

Methods inherited from BasicField

#errors, #errors=, #valid?, #validate, #validate_format, #validate_length, #validate_presence, #value, #value=

Methods included from Helpers

#tag, #tag_attributes, #tag_content

Constructor Details

#initialize(id, &block) ⇒ Group

Returns a new instance of Group.



129
130
131
132
133
# File 'lib/formalize/field.rb', line 129

def initialize(id, &block)
  super
  @choices = []
  instance_eval(&block)
end

Instance Method Details

#inputObject



134
135
136
# File 'lib/formalize/field.rb', line 134

def input
  @choices.collect { |choice| choice.input }.join("\n")
end