Ruby on Rails 中的表单重定向
到目前为止,在我的应用程序中,我有一个管理页面和一个项目页面。我的管理页面想要的是一个带有 *select_tag* 的表单,它显示所有现有项目。提交表单后,它将引导用户到“projects/#”,调用所选项目的“show”函数。
<h1> Admin Page </h1>
<br/><br/>
<%= form_tag( WHAT?, :method =>"put") do %>
<%= select_tag(:select_project, options_from_collection_for_select(Project.all, :id,:name), :size=>10) %>
<%= submit_tag("Show Project") %>
<% end %>
我一直在试图弄清楚该把什么放进去?我也相当确定我需要在某个地方更换控制器。任何输入都会有帮助
谢谢 SP
So far in my app, I have an admin page and a project page. What I want for my admin page is a form, with a *select_tag*, that displays all existing projects. Upon submitting the form, it will direct the user to "projects/#", calling the selected projects "show" function.
<h1> Admin Page </h1>
<br/><br/>
<%= form_tag( WHAT?, :method =>"put") do %>
<%= select_tag(:select_project, options_from_collection_for_select(Project.all, :id,:name), :size=>10) %>
<%= submit_tag("Show Project") %>
<% end %>
I've been trying to figure out what to put in WHAT?. I'm also fairly certain I need to change a controller somewhere. Any input would be helpful
Thanks
SP
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在你的控制器中
And in your controller