/ Published in: Ruby

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
module ActionView::Helpers::FormOptionsHelper def options_for_select_with_include_blank(container, selected = nil, include_blank = false) options = options_for_select_without_include_blank(container, selected) if include_blank options = "<option value=\"\">#{include_blank if include_blank.kind_of?(String)}</option>\n" + options end options end alias_method_chain :options_for_select, :include_blank def options_from_collection_for_select_with_include_blank(collection, value_method, text_method, selected = nil, include_blank = false) options = options_from_collection_for_select_without_include_blank(collection, value_method, text_method, selected) if include_blank options = "<option value=\"\">#{include_blank if include_blank.kind_of?(String)}</option>\n" + options end options end alias_method_chain :options_from_collection_for_select, :include_blank end
Comments
