In Rails, how to see all the “path” and “url” methods added by Rails's routing? (update: using Rails console)

后端 未结 3 478
陌清茗
陌清茗 2021-01-30 16:33

[update: by not using rake routes, just to understand Rails console a little more]

It seems like inside of \"rails console\" for Rails 3, w

相关标签:
3条回答
  • 2021-01-30 16:38

    Well in Rails 4, I use rake routes. Is it that you need?

    0 讨论(0)
  • 2021-01-30 16:45

    or load up localhost_path/rails/info/routes in your browser.

    0 讨论(0)
  • 2021-01-30 16:53
    helpers = Rails.application.routes.named_routes.helpers
    

    This will get you all the named route methods that were created. Then you can do helpers.map(&:to_s), and whatever regex you want to get your foo versions

    0 讨论(0)
提交回复
热议问题