Forum: Ruby on Rails library for URL parameters adding, removing, or replacing?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
winter h. (Guest)
on 2009-05-26 22:47
i think PHP doesn't have such simple functions yet...  does Ruby have
it?

if in PHP, when we add a param to the URL

$redirectURL = $printPageURL . "?mode=1";

it works if $printPageURL is "http://www.somesite.com/print.php", but if
$printPageURL is changed in the global file to
"http://www.somesite.com/print.php?newUser=1", then the URL becomes
badly formed. If the project has 300 files and there are 30 files that
append param this way, we need to change all 30 files.

the same if we append using "&mode=1" and $printPageURL changes from
"http://www.somesite.com/print.php?new=1" to
"http://www.somesite.com/print.php", then the URL is also badly formed.

is there a library in Ruby/Rails that will automatically handle the "?"
and "&", and even checks that existing param exists already and removed
that one because it will be replaced by the later one and it is not good
if the URL keeps on growing longer?
BenH (Guest)
on 2009-05-27 00:45
(Received via mailing list)
URL paramaters are usually passed as a hash, with that if a new key
matches and existing key the new key/value pair will overwrite the
existing key/value pair thus preventing duplicate entries.

Ben

On May 26, 11:47 am, Jian L. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.