Rails: how do you access RESTful helpers?

南楼画角 提交于 2019-11-29 20:37:20
Tim Knight

You have several questions in there, most of which have already been answered by people below.

The answer to one that wasn't fully addressed however, is: yes you can use the script/console to see where your routes go. Just type in app.[route_helper] and it will respond with the path. For example app.users_path will return /users/

So for your example type app.entries_url for the full URL - or app.entries_path for its relative path within the console.

rake routes at the command line should get you that list.

I think this may be what you are looking for ... http://topfunky.com/clients/peepcode/REST-cheatsheet.pdf

Matt Darby

You can access other helpers in the console by prepending "helper."; ie. helper.progress_box (assuming #progress_box exists of course)

From memory, you can't call url/path helpers from the console for some reason.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!