On Fri, Jan 27, 2012 at 00:54, Soichi I. [email protected]
when clicking the button, how can I automatically send the URL of the
corresponding video and simultaneously redirect to NEW page where users
can create a new video entry??? In other words, in the creating new
page, the URL (and hopefully the video_title) is to be already filled
Let me see if I understand correctly what you want. When you say
“send the URL” you don’t mean that the user should be sent to that
page (whether in the same tab or window, or a new one), but simply
that that should be the pre-filled value on the “New Video” page.
There may be a more “Railsy” way to do this, but what comes to my mind
Have the links link to #new, but add a parameter called something like
video_url. You could make it a URL parameter, so that rather than
going to myvideostore.com/videos/new, you’d go to
or whatever. (Actually the video_url should be url-encoded, but I
think Rails will handle that for you.) To do that, I think you can
pass a hash of params to link_to, or IWCTW you can tack it on
Or you can make them form params, so they don’t show up and look ugly
on the URL after the user clicks. Make a tiny form for each one.
Have the URL as a hidden field. Have the link submit the form, to the
Either way, in the controller, after you call Video.new, set the
object’s url to params[:video_url]. Then when you display it, the
value should show up just fine.
Let us know how that works for you.
Dave A.: Available Cleared Ruby on Rails Freelancer
(NoVa/DC/Remote) – see www.DaveAronson.com, and blogs at
www.Codosaur.us, www.Dare2XL.com, www.RecruitingRants.com