Class: ActionView::Helpers::InstanceTag

Inherits:
Object
  • Object
show all
Defined in:
lib/has_enum/helpers.rb

Instance Method Summary collapse

Instance Method Details

#to_radio_button_enum_tag(options = {}) ⇒ Object



15
16
17
18
19
20
# File 'lib/has_enum/helpers.rb', line 15

def to_radio_button_enum_tag(options = {})
  values_for_enum_tag.map do |val|
    radio_button = to_radio_button_tag(val.last, options)
    [radio_button, to_label_tag(val.first, :for => radio_button.match(/ id="(.*?)"/)[1])] * $/
  end.join($/)
end

#to_select_enum_tag(options = {}) ⇒ Object



22
23
24
25
# File 'lib/has_enum/helpers.rb', line 22

def to_select_enum_tag(options = {})
  html_options = options.delete(:html) || {}
  to_select_tag(values_for_enum_tag, options, html_options)
end

#values_for_enum_tagObject



27
28
29
# File 'lib/has_enum/helpers.rb', line 27

def values_for_enum_tag
  object.class.values_for_select_tag(method_name)
end