Class: RecurringSelectHelper::RecurringSelectTag

Inherits:
ActionView::Helpers::Tags::Base
  • Object
show all
Includes:
FormOptionsHelper, SelectHTMLOptions
Defined in:
lib/helpers/recurring_select_helper.rb

Instance Method Summary collapse

Methods included from FormOptionsHelper

#recurring_options_for_select

Constructor Details

#initialize(object, method, template_object, default_schedules = nil, options = {}, html_options = {}) ⇒ RecurringSelectTag

Returns a new instance of RecurringSelectTag.



97
98
99
100
101
102
103
104
105
106
107
# File 'lib/helpers/recurring_select_helper.rb', line 97

def initialize(object, method, template_object, default_schedules = nil, options = {}, html_options = {})
  @default_schedules = default_schedules
  @choices = @choices.to_a if @choices.is_a?(Range)
  @method_name = method.to_s
  @object_name = object.to_s
  @html_options = recurring_select_html_options(html_options)
  @template_object = template_object
  add_default_name_and_id(@html_options)

  super(object, method, template_object, options)
end

Instance Method Details

#renderObject



109
110
111
112
# File 'lib/helpers/recurring_select_helper.rb', line 109

def render
  option_tags = add_options(recurring_options_for_select(value, @default_schedules, @options), @options, value)
  (option_tags, @options, @html_options)
end