如何在Rails应用程序中获取所有路线? [英] how get all routes in my rails application?
本文介绍了如何在Rails应用程序中获取所有路线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以在Rails应用程序中获取所有路线吗?我需要类似 rake route
的输出,并将结果放入数组中。
can I get all routes in my rails application? I need an output like rake routes
and put the result in an array.
有可能吗?
推荐答案
您可以看看rails从rake任务中吐出那些路线的方式。它在Rails 2的 /gems/rails/2.3.x/lib/tasks/routes.rake
中。似乎基本上是在做 ActionController :: Routing :: Routes.routes
在一般情况下,然后对其进行审问。
You could have a look at way rails spits out those routes from the rake task. It's in /gems/rails/2.3.x/lib/tasks/routes.rake
for Rails 2. Seems to be basically doing ActionController::Routing::Routes.routes
in the general case and then interrogating that.
这篇关于如何在Rails应用程序中获取所有路线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文