Forum: Ruby on Rails Routes working with subdirectories repeat subdirectory...

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.
42292bf8a0acbc98862d9306b501275d?d=identicon&s=25 Daniel Waite (rabbitcreative)
on 2006-01-25 07:37
(Received via mailing list)
Hi all.

Views associated with admin controllers must always specify both
and :action when using link_to.


<%= link_to 'Edit', { :controller => '/raid_manager', :action =>
'edit_raid_template', :id => } %>

The above is being called from within the Admin::RaidManagerController.
controller was generated by using the Rails generate script, with a
argument of "admin/RaidManager". Whenever I use that format, it prepends
Admin:: to my class name - why? I know :: is the scope resolution
but there's scarce documentation about, even in the pick axe book.
more of an aside question.)

If I use link_to without specifying the controller, the link itself
but then I get something like:

It repeats the admin part. I also get the same effect even if I DO
the controller without the preceeeding /.

The routes that handle the admin area looks like:

map.connect '/admin/', :controller => 'admin/news_manager'
map.connect '/admin/:controller/:action/:id'

I don't like having to continually reference the controller, and I feel
I shouldn't have to. Also, I've found I'm unable to break out of the
admin/... URL once I'm in it.So like if I were to log out, and redirect
someone to :controller => 'pages', it would still look like admin/pages.

- Rabbit
42292bf8a0acbc98862d9306b501275d?d=identicon&s=25 Daniel Waite (rabbitcreative)
on 2006-01-25 08:04
(Received via mailing list)
That's interesting. If I get rid of the routing rule, standard link_to's
work fine. I know this will come back to haunt me though. =/

- Rabbit

This topic is locked and can not be replied to.