ELC Technologies  /  
To use this application you need the Adobe Flash Player

JS Routes plugin

By Cary Dunn / June 24, 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:

JSRoutes.get('users_path()')
 // returns: /users

JSRoutes.get('formatted_user_url(1, "js")')
 // returns: http://your.server/users/1.js

JSRoutes.get('this_does_not_exist(1, "2", 3, "xml")')
 // throws: JSRoutes::Unknown route: this_does_not_exist(1, "2", 3, "js")

Get it here: https://wush.net/svn/public/jsroutes Written by Jeff Emminger (ELC Alumni)



Comments

Interesting post?  Show some love and post a comment!
Using pieces of this code?  Post a link!

Add a Comment