辅助方法
让你有一个 HTML 的‘国家选择列表’你可以这么使用:
country_select("user", "country_name")
也可以这么用:
country_select("user", "country_name", [ "United Kingdom", "France", "Germany" ])
不为什么,因为它太‘简单’了。看看定义时的源代码吧。
# Return select and option tags for the given object and method, using country_options_for_select to generate the list of option tags.
def country_select(object, method, priority_countries = nil, options = {}, html_options = {})
InstanceTag.new(object, method, self, options.delete(:object)).to_country_select_tag(priority_countries, options, html_options)
end