This works great:
- form_for @user, :url => { :action => :create, :type => @type } do |f| ...
Returns /users/(id)?type=type
But in another view I need to pass TWO parameters into the URL string, and this does not work:
- form_for @user, :url => { :action => :update, :type => @type, :this => @currently_editing } do |f| ...
Returns /users/(id)?this=currently_editing
I've also tried:
- form_for @user, :url => { :action => :update, :params = params.merge({:this => @currently_editing, :type = @type})} do |f| ...
... with no luck (error: only GET requests allowed).
What I want is for it to return this: /users/(id)?this=currently_editing&type=type
Thoughts?
please try to this
you can pass more than one parameter in this way.
- form_for @user, :url => xxx_yyy_path(:param1 => value1, :params2 => value2, ......) do |f| ...
I would use hidden fields, but this should work:
<% form_for @user, :url => user_path(@user.id, :type => @type, :this => @currently_editing), :method => :put do |f| -%>
:method => :put
triggers the update action when using RESTful routes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With