how get all routes in my rails application?

后端 未结 3 1951
情书的邮戳
情书的邮戳 2020-12-25 14:09

can I get all routes in my rails application? I need an output like rake routes and put the result in an array.

Is it possible? how?

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-25 14:29

    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.

提交回复
热议问题