Routes working with subdirectories repeat subdirectory

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

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs