Forum: Ruby on Rails Noobish URI Question

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.
29d82d169c6037d4cbafce0b20fcf04e?d=identicon&s=25 The Barge (thebarge)
on 2006-04-11 15:45
Sorry if the answer has been posted but the search terms (like URI) are
so generic I get tons of useless results.

I have a controller (in this case "forum_controller") so if I want to
read a forum topic the URI is "/forum/topic/1".  As of right now for
adding a new topic my URI is setup as "/forum/new_topic".

I'd really like it to be something like "/forum/topic/new".  Is there
some method naming convention in the controller to allow for this?
5f79cc51f2e2e7b2bb982134e9c649e0?d=identicon&s=25 Jeroen van Doorn (Guest)
on 2006-04-11 16:00
(Received via mailing list)
you could do this with routing I presume ...

you'll get something like

  map.connect  "forum/topic/new",
                         :controller => "forum",
                         :action =>     "new_topic"

Kind regards,
Jeroen
29d82d169c6037d4cbafce0b20fcf04e?d=identicon&s=25 The Barge (thebarge)
on 2006-04-11 16:07
Jeroen van Doorn wrote:
> you could do this with routing I presume ...
>
> you'll get something like
>
>   map.connect  "forum/topic/new",
>                          :controller => "forum",
>                          :action =>     "new_topic"
>
> Kind regards,
> Jeroen

Yeah, I was hoping I could do something like name the method topic::new
or something similar but that didn't work.  I'll just leave it as
new_topic for now instead of creating custom routes for each instance.
This topic is locked and can not be replied to.