Forum: Ruby on Rails multiple controllers links

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.
7175322d35484ff625d2f707ecc46fe5?d=identicon&s=25 chandra s. (Guest)
on 2008-11-08 20:57
(Received via mailing list)
Hello experts,

I've got two different models and controllers. Lets call them Author
and Book respectively.  Also Author has_many :books, and Book
belong_to :author.

with this setup I get urls looking like
http://localhost:3000/author/14/book/173.

Is there a way to get rid of the 'book' controller name from the url?
I'd be more happy to see http://localhost:3000/author/14/173 instead.

Or my design is completely wrong and I am missing something importing?

I hope this can be accomplished with a routes, but not sure how.

Please point me out to the right direction.

Regards,
Chandra
D69d23d8e811e8ab2a8593380d6ede63?d=identicon&s=25 Jeff Emminger (jemminger)
on 2008-11-11 22:12
(Received via mailing list)
you could probably just set up your own route in config/routes.rb for
it, or maybe some of the configuration options for map.resources can
do it:
http://api.rubyonrails.org/classes/ActionControlle...


On Nov 8, 1:55 pm, "chandra s." <chandrasekhars...@googlemail.com>
This topic is locked and can not be replied to.