Rails way of constructing an url with post parameters of a form

I would like to do that's the best way of actually accomplishing the following on Rails.

I have a "Booking Form" with 5 fields (Property, Amount of Children, Amount of Adults and 2 Dates - Departure and Arrival) based on these fields, I need to construct an URL and redirect the user to this url. Now, I have 2 questions.

1) How i catch the POST parameters in the controller, because I'm mapping the form to an action like this:

<% form_tag(:action => "booking") do %>

and routing it to a controller action like this: (Pages Controller, Booking Action)

match 'pages/booking' => 'pages#booking'

2) Is this the Rails way of actually accomplishing such thing?

I did it this way in PHP in the past, but now I have the need of actually doing it in Rails, could you Rails Gurus inspire me ?

I would like to do that's the best way of actually accomplishing the following on Rails.

I have a "Booking Form" with 5 fields (Property, Amount of Children, Amount of Adults and 2 Dates - Departure and Arrival) based on these fields, I need to construct an URL and redirect the user to this url. Now, I have 2 questions.

1) How i catch the POST parameters in the controller, because I'm mapping the form to an action like this:

They'll be in params. You might make your life slightly easier if you name your parameters foo[p1], foo[p2] etc, because then all your parameters are in params[:foo]. Hash#to_query turns a hash back into a query string.

<% form_tag(:action => "booking") do %>

and routing it to a controller action like this: (Pages Controller, Booking Action)

match 'pages/booking' => 'pages#booking'

2) Is this the Rails way of actually accomplishing such thing?

I don't quite understand what you are doing. What's the point of the intermediate action?

Fred

I already did it, but perhaps you can point me in a better way.

I made a class called Booking Information: https://gist.github.com/785209

Where I'll store the post parameters of my interest like this:

    @booking_info = BookingInformation.new(                   params[:properties],                   params[:children],                   params[:adults],                   params[:checkin],                   params[:checkout],                   params[:locale]     )

after that I'll just redirect the user to the proper URL with redirect_to(@booking_info.output_url)

The reason why I'm doing this is because I have a form where based on the user input of a given property, date-range and amount of persons, must redirect to a URL constructed with the given parameters (The code is the gist),

That's the point of the intermediate action (More specifically based on the property an chain and propertyID must be assigned)

Any help anyone? :frowning: