Forum: Ruby on Rails dynamically modifying a url

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
3718778c12704a365dbdce5fab9f58d1?d=identicon&s=25 carlos (Guest)
on 2007-02-02 04:27
I am prototyping a video centric application.

A page consists of:

- a player
- a list of available clips
- a "forward to a friend" link

The forward to a friend link will present the user with a form to send a
email with a link to the clip --currently being played--.  The player
has a javascript api that provides the ID of the currently playing clip.

Is there a common method of rendering a rails URL that takes into
account query parameter values that are dynamically generated on the
client side?  I am currently:

- using url_for to generate the base url
- and then using link_to_function to call a client side function that
takes the base url as an argument.  The client side function then
appends the current clip id as a query param and then sets the
location.href to the new url.

I am relatively new to the framework, however it appears as if rails is
going to great lengths to shield the developer from knowing how to
encode or decode URLs.  What I am doing is a violation of that
encapsulation and is pretty brittle.

Is there a view helper that already does this?  Any better ideas?

This topic is locked and can not be replied to.