开发者

How can I pass a parameter along with f.submit?

开发者 https://www.devze.com 2023-02-15 12:12 出处:网络
I have a for开发者_如何学编程m for creating a new user. I\'d like to pass a paramater, page, with f.submit, something like:

I have a for开发者_如何学编程m for creating a new user. I'd like to pass a paramater, page, with f.submit, something like:

<%= f.submit (:cove_id=>@cove)%>

Is this possible in Rails?


put the parameter inside the form, not in the submit button (for example, use a hidden_field to do that)


Also, if cove_id is a foreign key on a parent model (ie: your form model belongs_to cove), consider going the nested resources route.

http://guides.rubyonrails.org/routing.html#nested-resources

0

精彩评论

暂无评论...
验证码 换一张
取 消