We have the unusual requirement of a multi-step form through GET requests. So, instead of POSTing the forms, we're using GET requests to pass new parameters to the query. So, the basic idea is that there's a treatment, and a date passed to the query. A three-step form if you will.
- Show available treatments, pick one
- Show available dates (there's business logic in the background that figures these out)
- Pick a time
The URL will go through the following states
- site.com/bookings/new
- site.com/bookings/new/[id|name_of_treatment] (by this, I mean it could either by the ID field or the name of the the treatment)
- site.com/bookings/new/[id|name_of_treatment]/2010-12-12/
So, my route looks like this:
map.connect 'bookings/new/:massage_type/:date', :controller => :bookings, :action => :new
massage_type is synonymous with the treatment_id.
So my form_tag looks like this:
<% form_tag( {:action => "new"}, :method => "get" ) do %>
The problem I'm having is that I want it to just give me back the URL site.com/bookings/new/[id|name_of_treatment]/ but instead it gives back the following URL:
http://localhost:3000/bookings/new?massage_type[treatment_id]=1&commit=actionnew
I don't suppose anyone knows?