John
John

Reputation: 5905

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

I have a form 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?

Upvotes: 0

Views: 1567

Answers (2)

Josh Deeden
Josh Deeden

Reputation: 1690

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

Upvotes: 0

Andrei S
Andrei S

Reputation: 6516

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

Upvotes: 2

Related Questions