Ok, well in that case, do the URL to the proper controller method. Instead of using posts_path, make a complete URI for the method you want to hit. The only reason that your POST method request to the posts_controller is ending up on the new method is because you're not sending an unambiguous request, so REST is taking over.

Looking back at your original request, you wanted to be sending a GET request that looked like posts/search/rails, where rails was a query term. I'm not sure how you could send that request in the first place unless you used JavaScript to send the form request. A form has an action, and that's fixed, not modified by the contents of the form's elements. The body of the form request contains all of the elements and their values at the time the form was submitted. But that doesn't change the action. Using JavaScript, it's trivial to rewrite the action of the request before sending the form.

Walter

On Feb 20, 2011, at 8:49 PM, Moon Moon wrote:

"Posts" model has been generating via a scaffold so if I use the method
post it will correspond to the new method.

--
Posted via http://www.ruby-forum.com/.

--
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 rubyonrails- [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.

Reply via email to