Forum: Ruby on Rails Problem using url_for

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.
6924d3c3526c4cf23250edd56c9abc56?d=identicon&s=25 Rakesh Malik (Guest)
on 2006-05-04 23: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:
http://localhost:3000/content/get_resource?type=<type>
(the <type> is correct, the issue is tha the ID is entirely missing).

What am I doing wrong here?

Thanks!
7f023e9ef20f259eebbda8f5d7a88d6b?d=identicon&s=25 Ben and Kaz Askins (Guest)
on 2006-05-05 00:48
(Received via mailing list)
On 5/5/06, Rakesh Malik <tamerlin@gmail.com> 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 =>
item,
:type => item['type']

cheers,
Ben
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2006-05-05 00:58
(Received via mailing list)
Rakesh Malik 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.
6924d3c3526c4cf23250edd56c9abc56?d=identicon&s=25 Rakesh Malik (Guest)
on 2006-05-05 05:54
(Received via mailing list)
Thanks for the suggestions. I'll see what happens tomorrow when I get
back
to the office.
This topic is locked and can not be replied to.