Skip to content


Clarify advanced setup instructions #99

merged 2 commits into from

2 participants


I updated the readme instructions for the "very advanced setup" based on the discussion in #98


Looks pretty good.

But did you delete an examples with routes in a string routes = JsRoutes.generate ?


Well I thought that is obvious from the way the routes are written in app/assets/javascripts/admin/routes.js.erb and app/assets/javascripts/application/routes.js.erb, but I can add it again if you think it makes more sense.


Hm, you are right, but lets be obvious for people that are looking exactly for this variant.

@bogdan bogdan merged commit 7f52df6 into railsware:master

1 check passed

Details default The Travis CI build passed
@manuelmeurer manuelmeurer deleted the krautcomputing:readme_fix branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 24, 2014
  1. @manuelmeurer
Commits on Feb 28, 2014
  1. @manuelmeurer
Showing with 25 additions and 9 deletions.
  1. +25 −9
@@ -67,9 +67,32 @@ Available options:
### Very Advanced Setup
-In case you need multiple route files for different parts of your application, you can not use asset pipeline.
+In case you need multiple route files for different parts of your application, you have to create the files manually.
+If your application has an `admin` and an `application` namespace for example:
-You need to generate routes files on the application side like this:
+# app/assets/javascripts/admin/routes.js.erb
+<%= JsRoutes.generate(namespace: "AdminRoutes", include: /admin/) %>
+# app/assets/javascripts/
+#= require admin/routes
+# app/assets/javascripts/application/routes.js.erb
+<%= JsRoutes.generate(namespace: "AppRoutes", exclude: /admin/) %>
+# app/assets/javascripts/
+#= require application/routes
+In order to generate the routes to a string:
+routes_js = JsRoutes.generate(options)
+If you want to generate the routes files outside of the asset pipeline, you can use `JsRoutes.generate!`:
``` ruby
path = "app/assets/javascripts"
@@ -78,13 +101,6 @@ JsRoutes.generate!("#{path}/adm_routes.js", :namespace => "AdmRoutes", :include
JsRoutes.generate!("#{path}/api_routes.js", :namespace => "ApiRoutes", :include => /^api_/, :default_url_options => {:format => "json"})
-In order to generate javascript to string and manipulate them yourself use:
-``` ruby
-routes_js = JsRoutes.generate(options)
## Usage
Configuration above will create a nice javascript file with `Routes` object that has all the rails routes available:
Something went wrong with that request. Please try again.