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

后端 未结 3 482
陌清茗
陌清茗 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: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

提交回复
热议问题