<%= select_tag 'pseudo-attribute', options_for_select(...), :include_blank => 'Nowhere'%>
这个标签用来包含一个空白选项"无处",但现在文本框是空白的,有人知道为什么吗?
现在选择标签的代码是(Rails 3.1.0.rc4)
def select_tag(name, option_tags = nil, options = {})
html_name = (options[:multiple] == true && !name.to_s.ends_with?("[]")) ? "#{name}[]" : name
if options.delete(:include_blank)
option_tags = "<option value=""></option>".html_safe + option_tags
end
if prompt = options.delete(:prompt)
option_tags = "<option value="">#{prompt}</option>".html_safe + option_tags
end
content_tag :select, option_tags, { "name" => html_name, "id" => sanitize_to_id(name) }.update(options.stringify_keys)
end
意味着你必须用:prompt
代替:include_blank
。如果您想在选择字段中使用空白选项,请使用include blank:)