Try ':method => :put' (without the quotes). Rails is not always consistent. Some places either strings or symbols work, other places they don't.
HTH, Jeffrey Quoting Jonhy Pear <[email protected]>: > I made some researche and found in Ruby on Rais guides that I'm doing the > correct thing... but I'm not getting the correct results. I know I'm missing > something... what is? > > http://guides.rubyonrails.org/form_helpers.html#how-do-forms-with-put-or-delete-methods-work > > <http://guides.rubyonrails.org/form_helpers.html#how-do-forms-with-put-or-delete-methods-work>Can > you help? > > On Sat, Dec 12, 2009 at 8:22 PM, Jonhy Pear <[email protected]> wrote: > > > Hi, > > > > I'm trying to emulate a post from a HTML form. I've the following code in > > erb: > > > > <h1>Alterar Password</h1> > > <% form_tag :action=>"reset_password", :method=>"put" do%> > > <p> > > <%=label_tag :password, "Nova password" %> > > </p> > > <p> > > <%=password_field_tag :password, @password %> > > </p> > > <p> > > <%=label_tag :password_confirmation, "Confirmação Password" %> > > </p> > > <p> > > <%=password_field_tag :password_confirmation, @password_confirmation %> > > </p> > > <%=submit_tag "Alterar Password" %> > > <%end %> > > > > In my action I have something similar to this: > > > > > > def reset_password > > if request.get? > > #do something for get > > elsif request.put? > > #do something for put > > else > > raise Webapp::BadRequestError > > end > > > > rescue Webapp::BadRequestError > > logger.error("Invalid Request type. Client IP: "+request.remote_ip) > > flash_error(:invalid_request) > > redirect_to root_url > > end > > > > I've functional tests for put and get, and everything is fine. But when the > > form is rendered and tested in a browser I can't get this working. In > > Firefox, the output for the erb is something like: > > > > <form > > action="/user/reset_password/1/dd98e038fe7ab8570373307dfa710ecd86e782b00704dd172e546379acbf0a54?method=put" > > method="post"><div style="margin:0;padding:0;display:inline"><input > > name="authenticity_token" type="hidden" > > value="rOSsudVMJFZctILVNtSIyCfwJPvX4XOiUuLFxwZgyIA=" /></div> > > <p> > > <label for="password">Nova password</label> > > </p> > > <p> > > <input id="password" name="password" type="password" value="" /> > > </p> > > <p> > > <label for="password_confirmation">Confirmação Password</label> > > </p> > > <p> > > <input id="password_confirmation" name="password_confirmation" > > type="password" value="" /> > > </p> > > <input name="commit" type="submit" value="Alterar Password" /> > > </form> > > > > Everytime I submit the form I then hit in the Webapp::BadRequestError > > > > Can someone help me get over this? > > > > > > -- > João Miguel Pereira > http://jpereira.eu > LinkedIn: http://www.linkedin.com/in/joaomiguelpereira > [email protected] > (351) 96 275 68 58 > > -- > > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

