Forum: Ruby on Rails Problem using url_for

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.
Rakesh M. (Guest)
on 2006-05-05 01:34
(Received via mailing list)
I'm trying to generate a URL of the form
controller/action?id=<id>&type=<type>. My code looks like this:

url_for(:controller => 'content',
      :action => 'get_resource',:id => item['Id'],:type => item['type']

The url I end up with looks like this:
(the <type> is correct, the issue is tha the ID is entirely missing).

What am I doing wrong here?

Ben and Kaz A. (Guest)
on 2006-05-05 02:48
(Received via mailing list)
On 5/5/06, Rakesh M. <removed_email_address@domain.invalid> wrote:
> (the <type> is correct, the issue is tha the ID is entirely missing).

Fairly certain you need to drop the ['id'] e.g.

url_for :controller => 'content', :action => 'get_resource', :id =>
:type => item['type']

Mark Reginald J. (Guest)
on 2006-05-05 02:58
(Received via mailing list)
Rakesh M. wrote:
> What am I doing wrong here?

The capital I in 'Id' should be lower-case.

We develop, watch us RoR, in numbers too big to ignore.
Rakesh M. (Guest)
on 2006-05-05 07:54
(Received via mailing list)
Thanks for the suggestions. I'll see what happens tomorrow when I get
to the office.
This topic is locked and can not be replied to.