Trim information from url?

hi,
my url after performing a call to a database looks like this:

http://localhost:3000/myapp/view?scat=3&mcat=4

is there a way to chop off the “?scat=3&mcat=4” part of the url?

well without a refresh or a render i think not

koloa wrote:

hi,
my url after performing a call to a database looks like this:

http://localhost:3000/myapp/view?scat=3&mcat=4

is there a way to chop off the “?scat=3&mcat=4” part of the url?

koloa wrote:

hi,
my url after performing a call to a database looks like this:

http://localhost:3000/myapp/view?scat=3&mcat=4

is there a way to chop off the “?scat=3&mcat=4” part of the url?

How about

url.sub(/?.*/, ‘’)

Example:

irb(main):015:0> url = ‘http://localhost:3000/myapp/view?scat=3&mcat=4
=> “http://localhost:3000/myapp/view?scat=3&mcat=4
irb(main):016:0> url.sub(/?.*/, ‘’)
=> “http://localhost:3000/myapp/view

Proper ? should normally arrive escaped in the URL.

Stephan

koloa wrote:

my url after performing a call to a database looks like this:

http://localhost:3000/myapp/view?scat=3&mcat=4

is there a way to chop off the “?scat=3&mcat=4” part of the url?

Can you fetch that page via POST instead of GET? The latter sends the
display data as a batch of variables inside the POSTing message, not as
part
of the URL.

Your calling function might have a :method option to switch to ‘post’.


Phlip
Redirecting... ← NOT a blog!!!