The ELC Community Blog
A knowledge exchange on Ruby on Rails and Agile Development
JS Routes plugin
by Jeff Emminger on June 06, 2008
Here's a little plugin to make working with Rails routing in Javascript easier. It generates jsroutes.js each time your app starts, which allows you to use routes like so:
1 JSRoutes.get('users_path()')
2 // returns: /users
3
4 JSRoutes.get('formatted_user_url(1, "js")')
5 // returns: http://your.server/users/1.js
6
7 JSRoutes.get('this_does_not_exist(1, "2", 3, "xml")')
8 // throws: JSRoutes::Unknown route: this_does_not_exist(1, "2", 3, "js")
Get it here: https://wush.net/svn/public/jsroutes
Comments