Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 选择框的Rails简单表单自定义集合_Ruby On Rails_Ruby_Simple Form - Fatal编程技术网

Ruby on rails 选择框的Rails简单表单自定义集合

Ruby on rails 选择框的Rails简单表单自定义集合,ruby-on-rails,ruby,simple-form,Ruby On Rails,Ruby,Simple Form,有没有一种方法可以使选择框中的标签在自定义集合的简单形式下具有不同的值 下面是我的一个例子: = f.input :hall_type, collection: ["Main", "Exhibition", "Conference", {"KnowedgeLibrary" => "Knowedge Library"}], prompt: "Choose a hall type" 我希望KnowledgeLibrary成为值,KnowledgeLibrary成为选项的标签/文本=f.sel

有没有一种方法可以使选择框中的标签在自定义集合的简单形式下具有不同的值

下面是我的一个例子:

= f.input :hall_type, collection: ["Main", "Exhibition", "Conference", {"KnowedgeLibrary" => "Knowedge Library"}], prompt: "Choose a hall type"

我希望
KnowledgeLibrary
成为值,
KnowledgeLibrary
成为选项的标签/文本

=f.select:hall\u type,options\u for\u select([“Main”,“exposition”,“Conference”,“Knowledge Library”,“KnowledgeLibrary”],“KnowledgeLibrary”),{prompt:“Choose a hall type”}

以下是语法

:collection => [['label1', 'value1'], ['label2', 'value2']]