Accessing rails routes in javascript
问题 Can anyone explain how i can access the rails routes/names routes in javascript ? The following are some of the things i tried http://github.com/jsierles/js_named_routes. but no luck. 回答1: I was researching this question for a while and didn't found any implementation compatible with Rails 3. So decided to write my own: https://github.com/railsware/js-routes 回答2: kishore I think this is the simpliest way, just call: Rails.application.routes.url_helpers.*_path So, if you have in your routes.rb