I renamed my Rails asset-pipeline routing integration gem to asset_pipeline_routes, after merging changes from @ubermajestix.
You can find it on https://github.com/nicolai86/asset_pipeline_routes or https://rubygems.org/gems/asset_pipeline_routes.
Besides renaming the gem I also took my time to add some small changes:
-
asset_pipeline_routesrequires Rails v 3.2.0 or greater -
all generated methods now take a parameter which is used to generate the resulting route.
E.g. given
resources :usersin yourroutes.rb# application.js.erb <%= r.edit_user_path %> // => yields '/users/{{ site.lcb }}{{ site.lcb }}id{{ site.rcb }}{{ site.rcb }}/edit' <%= r.edit_user_path '\d+' %> // => yields '/users/\d+/edit' -
besides the regular
_pathmethodsasset_pipeline_routesnow also generates_methods which return anonymous JavaScript functions to generate the correct routes on the client-side:E.g. given
resources :usersin yourroutes.rb# application.js.erb var editUserPath = <%= r.edit_user_method %>; // => yields an anonymous function alert(editUserPath(42)); // => alerts '/users/42/edit'
Happy hacking!