我有这样的一行:
<%= f.input :state_id, :input_html => {:value => (policy_address.state.name rescue nil)}, :required => true, :collection => states.map {|s| [ s.name, s.id] }, :include_blank => 'Please select'%>
我想从states.map
集合中排除一个值。我认为这会起作用,但它不会:
<%= f.input :state_id, :input_html => {:value => (policy_address.state.name rescue nil)}, :required => true, :collection => states.map {|s| [ s.name, s.id] unless s.name == "excluded_state" }, :include_blank => 'Please select'%>
我输入了unless s.name == "excluded_state
,但是,它再次不起作用:
我究竟做错了什么?