Class: VCFB::Component::CollectionSelect

Inherits:
Base
  • Object
show all
Defined in:
lib/vcfb/component/collection_select.rb

Instance Method Summary collapse

Methods inherited from Base

#collection_check_boxes, #collection_radio_buttons

Constructor Details

#initialize(form, method, collection, value_method, text_method, options = {}, html_options = {}) ⇒ CollectionSelect

Returns a new instance of CollectionSelect.



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/vcfb/component/collection_select.rb', line 4

def initialize(form, method, collection, value_method, text_method, options = {}, html_options = {})
  run_callbacks :initialize do
    @form = form
    @method = method
    @collection = collection
    @value_method = value_method
    @text_method = text_method
    @options = defined?(TagOptions::Hash) ? TagOptions::Hash.new(options) : options
    @html_options = defined?(TagOptions::Hash) ? TagOptions::Hash.new(html_options) : html_options
  end
end

Instance Method Details

#form_element(options = {}, html_options = {}) ⇒ Object



16
17
18
# File 'lib/vcfb/component/collection_select.rb', line 16

def form_element(options = {}, html_options = {})
  collection_select(@form.object_name, @method, @collection, @value_method, @text_method, options, html_options)
end