我一直在将详细的Ruby / Sinatra脚本转换为Rails,并且遇到了提交表单选定值的问题。路径应该结束http://localhost:3000/show?application=app&version=1.0.0。
这是我的代码:
<form>
<span title= "Application Name">
Application:
<%= collection_select(:DeathBurritoApplication, :death_burrito_name, @applications, :death_burrito_name, :death_burrito_name) %>
</span>
<span title="Version">
Jira Version:
<%= select("JiraBug", "jira_version_name", @jira_ver_array, :selected => params[:version] ) %>
</span>
<span title="Death Burrito Version">
Death Burrito Version: <%= select("DeathBurritoAppVersion", "death_burrito_version", @db_ver_array ) %>
</span>
<span title="Submit"><%= link_to "Submit", :controller => "dashboard", :action => "show", :application => @application, :version => "" %></span>
</form>
这是生成的html:
<form>
<span title= "Application Name">
Application:
<select id="DeathBurritoApplication_death_burrito_name" name="DeathBurritoApplication[death_burrito_name]"><option value="LongListOfAppsIRemoved">LongListOfAppsIRemoved</option>
</span>
<span title="Version">
Jira Version:
<select id="JiraBug_jira_version_name" name="JiraBug[jira_version_name]"><option value="Not assigned">Not assigned</option>
<option value="6.20.1">6.20.1</option>
<option value="6.22">6.22</option>
<option value="6.23">6.23</option>
<option value="6.24">6.24</option>
<option value="Future release">Future release</option>
<option value="6.26">6.26</option></select>
</span>
<span title="Death Burrito Version">
Death Burrito Version: <select id="DeathBurritoAppVersion_death_burrito_version" name="DeathBurritoAppVersion[death_burrito_version]"><option value="Not Found">Not Found</option></select>
</span>
<span title="new_submit"><a href="/dashboard/show?application=Applyweb+Web&version=">Submit</a></span>
<span title="Submit"><input class="graph_button" id="dashboard_submit_button" src="/images/submit.png?1311179528" type="image" /></span>
</form>
答案 0 :(得分:0)
我的脚本存在一些问题,即更改为form_tag,select_tag和submit_tag已解决。