Reputation: 6036
In my routes I added this two routes
match '/:controller(/:action(/:id))', :controller => /admin\/[^\/]+/
match '/:controller(/:action(/:id))'
When I goes to invalid route then giving me
The action 'dashboard1' could not be found for Admin::AdminController
I added below line at the end of the routes.rb file
match "*path" => redirect("/")
But it's not working.
I am using rails 3.2.x
Please Help me, Thanks In Advance
Upvotes: 0
Views: 317
Reputation: 2237
wouldn't the two routes catch everything that is in controller/action format?
I guess you are doing everything in admin controller or redirecting to proper controllers and actions, by parsing the params in the admin, redirection to home page should be done in the controller where you are doing that, perhaps a begin rescue block?
begin
....rerouting logic
rescue
redirect_to home_page
end
of course you should check if the exception is the correct one and so forth.
Upvotes: 1