Class: Bureaucrat::Fields::ComboField

Inherits:
Field
  • Object
show all
Defined in:
lib/bureaucrat/fields.rb

Overview

TODO: tests

Instance Attribute Summary

Attributes inherited from Field

#error_messages, #help_text, #hidden_widget, #initial, #label, #required, #show_hidden_initial, #validators, #widget

Instance Method Summary collapse

Methods inherited from Field

#bound_data, #default_error_messages, #default_hidden_widget, #default_validators, #default_widget, #initialize_copy, #populate_object, #prepare_value, #run_validators, #to_object, #validate, #widget_attrs

Constructor Details

#initialize(fields = [], *args) ⇒ ComboField



660
661
662
663
664
# File 'lib/bureaucrat/fields.rb', line 660

def initialize(fields=[], *args)
  super(*args)
  fields.each {|f| f.required = false}
  @fields = fields
end

Instance Method Details

#clean(value) ⇒ Object



666
667
668
669
670
# File 'lib/bureaucrat/fields.rb', line 666

def clean(value)
  super(value)
  @fields.each {|f| value = f.clean(value)}
  value
end