Class: CheckboxField
- Inherits:
-
BasicField
- Object
- BasicField
- CheckboxField
- Defined in:
- lib/formalize/field.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
Returns the value of attribute opts.
Instance Method Summary collapse
-
#initialize(id, opts = {}) ⇒ CheckboxField
constructor
A new instance of CheckboxField.
- #input ⇒ Object
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, opts = {}) ⇒ CheckboxField
Returns a new instance of CheckboxField.
117 118 119 120 |
# File 'lib/formalize/field.rb', line 117 def initialize(id, opts={}) super @opts[:type] = :checkbox end |
Instance Attribute Details
#opts ⇒ Object
Returns the value of attribute opts.
116 117 118 |
# File 'lib/formalize/field.rb', line 116 def opts @opts end |
Instance Method Details
#input ⇒ Object
121 122 123 124 125 |
# File 'lib/formalize/field.rb', line 121 def input attrs = @opts.dup attrs[:name] = attrs[:name].to_s << '[]' super(attrs) end |