Forum: Ruby on Rails New route method on every controller

Posted by javinto (Guest)
on 2013-02-21 15:49
(Received via mailing list)
Hi

In my routes I have a

match ":controller/help", :action=>'help'     (Rake routes shows:
/:controller/help(.:format)            :controller#help)

This will add a help action on every controller, including namespaced
controllers.

As Rails 4 will not be supporting 'match' anymore I'm converting these
routes to get, put, etc. No sweat, except for this route:

get ':controller/help'        (Rake routes shows: GET
/:controller/help(.:format)
:controller#help)

This route does not work on namespaced controllers, like:

namespace :admin do
    myController
end

I tried declaring:

namespace :admin do
    get ':controller/help'
    myController
end

But rake routes is telling me: :controller segment is not allowed within 
a
namespace block

Is there another solution to this?
Posted by Pardeep Dhingra (pardeepdhingra)
on 2013-02-28 12:10
I think you need

get ':controller/help'
and

get ':namespace/:controller/help'
Posted by Jan Verhoek (Guest)
on 2013-02-28 12:23
(Received via mailing list)
Worth trying! But unfortunately not working neither. But thanks!

Op 28 feb 2013, om 12:10 heeft Pardeep Dhingra het volgende geschreven:
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.