Hide query string shown in URL from redirect_to

Hi,

I’m using redirect_to to return to a page after some processing has been
done on some data. Here is an example of its usage:

redirect_to :action => ‘daily’, :day => params[:day], :month =>
params[:month], :year => params[:year]

This is all great and I have access to my params[] in the ‘daily’ method
however all of these params appear in a query string, part of the URL:

http://localhost:3004/bookings/daily?month=2&year=2007&day=8

Is there a way I can prevent this?

Thanks
Henry

Henry B. wrote:

Hi,

I’m using redirect_to to return to a page after some processing has been
done on some data. Here is an example of its usage:

redirect_to :action => ‘daily’, :day => params[:day], :month =>
params[:month], :year => params[:year]

This is all great and I have access to my params[] in the ‘daily’ method
however all of these params appear in a query string, part of the URL:

http://localhost:3004/bookings/daily?month=2&year=2007&day=8

Is there a way I can prevent this?

Thanks
Henry

you could post it in a form using button_to or you could pretty it up by
adding to the routes file

Keynan P. wrote:

you could post it in a form using button_to or you could pretty it up by
adding to the routes file

Sorry maybe I should have explained a bit better. I have a page
containing a form which, when the user submits, the data is sent to a
method that does processing. This method has no associated view and
redirects to the ‘daily’ method and it’s view on failure/success. As it
has no view I can’t put a form in there.

I had thought about using routes to hide it but I thought there may have
been a way I could tell redirect_to to use POST instead of GET or
something to fix it at source rather than by just hiding it?

sorry that was my bad.

since this controller method has no view could you call the second
directly and then render its result within the original method?

Technically yes. However the app itself is a lot more complex and
involves a lot more parameters than I included in the example… I’ve
been trying hard to follow the DRY principle so to reassign the params
to what is required would cause me to double up some code. Hmmm…

Maybe I’ll just hide it then! Any tips for making the URL show only the
domain on every single page and nothing else like the current
controller/action etc…?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs