如何在我的 Rails f.select 项目中预先 select 一个选项?

How do I pre-select an option in my Rails f.select item?

我正在使用 Rails 5。我想在我的表单中预 select 一个选项。我模型中的字段是布尔值,但显然选项(文本和值)是字符串。所以我尝试了这个

<%= f.select :bool_field, options_for_select([["Above", "false"], ["Below", "true"]]), @my_event.nil? ? nil : @my_event.bool_field.to_s, {:prompt => "Select Object"} %>

但我得到了一个

undefined method `merge' for "false":String

页面呈现错误。在我的表单中预 select 一个选项的正确方法是什么?

括号错误:

<%= f.select :bool_field, options_for_select([["Above", "false"], ["Below", "true"]], @my_event.nil? ? nil : @my_event.bool_field.to_s), {:prompt => "Select Object"} %>