Class: VCFB::Component::Select
- Defined in:
- lib/vcfb/component/select.rb
Instance Method Summary collapse
- #before_render ⇒ Object
- #form_element(options = {}, html_options = {}) ⇒ Object
-
#initialize(form, method, choices = nil, options = {}, html_options = {}) ⇒ Select
constructor
A new instance of Select.
Methods inherited from Base
#collection_check_boxes, #collection_radio_buttons
Constructor Details
#initialize(form, method, choices = nil, options = {}, html_options = {}) ⇒ Select
Returns a new instance of Select.
4 5 6 7 8 9 10 11 12 |
# File 'lib/vcfb/component/select.rb', line 4 def initialize(form, method, choices = nil, = {}, = {}) run_callbacks :initialize do @form = form @method = method @choices = choices @options = defined?(TagOptions::Hash) ? TagOptions::Hash.new() : @html_options = defined?(TagOptions::Hash) ? TagOptions::Hash.new() : end end |
Instance Method Details
#before_render ⇒ Object
14 15 16 |
# File 'lib/vcfb/component/select.rb', line 14 def before_render @choices = content if content.present? end |
#form_element(options = {}, html_options = {}) ⇒ Object
18 19 20 |
# File 'lib/vcfb/component/select.rb', line 18 def form_element( = {}, = {}) select(@form.object_name, @method, @choices, , ) end |