In my Rails 3.0 app I have a series of very large search forms on my resource:index page, requiring the use of POST instead of GET.
Currently, the app is routing the POST request to resource#create, when I want it to route to resource#index. I realize this is the RESTful route, but need to override it. How can I do that, while also preserving the ability to create a new record of that resource?
Thanks much.
You're better off having a "search" action that is post-only - and then renders the index template eg:
class MyController < ...
def search
@my_things = MyThing.find_with_search_params(params[:search])
render :action => :index
end
end
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