<% require "rails-routes-js-utils" %> window.Routes = {}; function addRouteToEnv(obj) { window.Routes[obj.name+'_path'] = obj.replace } <%= Rails::Routes::Js::Utils.generate %>