Recognize routes in rails console Session

前端 未结 5 2065
无人共我
无人共我 2020-12-12 10:25

Say I have a router helper that I want more info on, like blogs_path, how do I find out the map statements behind that in console.

I tried generate and recognize and

5条回答
  •  無奈伤痛
    2020-12-12 10:56

    Basically(if I understood your question right) it boils down to including the UrlWriter Module:

       include ActionController::UrlWriter
       root_path
       => "/"
    

    Or you can prepend app to the calls in the console e.g.:

       ruby-1.9.2-p136 :002 > app.root_path
       => "/" 
    

    (This is all Rails v. 3.0.3)

提交回复
热议问题