Class: ActionView::Helpers::InstanceTag
- Defined in:
- lib/plugins/option_tags_with_disable/lib/option_tags_will_disable.rb
Instance Method Summary collapse
- #to_collection_select_tag(collection, value_method, text_method, options, html_options) ⇒ Object
- #to_select_tag(choices, options, html_options) ⇒ Object
Instance Method Details
#to_collection_select_tag(collection, value_method, text_method, options, html_options) ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/plugins/option_tags_with_disable/lib/option_tags_will_disable.rb', line 73 def to_collection_select_tag(collection, value_method, text_method, , ) = .stringify_keys add_default_name_and_id() value = value(object) disabled_value = .has_key?(:disabled) ? [:disabled] : nil content_tag( "select", ((collection, value_method, text_method, value, disabled_value), , value), ) end |
#to_select_tag(choices, options, html_options) ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/plugins/option_tags_with_disable/lib/option_tags_will_disable.rb', line 64 def to_select_tag(choices, , ) = .stringify_keys add_default_name_and_id() value = value(object) selected_value = .has_key?(:selected) ? [:selected] : value disabled_value = .has_key?(:disabled) ? [:disabled] : nil content_tag("select", ((choices, selected_value, disabled_value), , selected_value), ) end |