Permalink
Browse files

now a gem

  • Loading branch information...
1 parent b1b5d98 commit a5fcabb6a0653e39cac22c15459a4ad376191e27 @collin committed Feb 2, 2009
Showing with 24 additions and 14 deletions.
  1. +24 −14 README
  2. BIN merb_javascript_named_routes-0.0.1.gem
View
38 README
@@ -17,20 +17,30 @@ No. Not anymore.
For I have written a naive url writer in javascript.
-First we put it in our view: (erb)
-
- <script src="/javascripts/url_writer.js"></script>
- <script>
- Merb.compile_routes(
- <%= Merb::Router.named_routes.to_json %>
- ,<%= Merb::Router.resource_routes.inject({}){|hash, rr| hash[rr.first.join(',')] = rr.last; hash}.to_json %>
- );
- </script>
-
-Oh god! How terrible. How nasty. How frail and brittle. Clearly this
-will not stand the test of time. Oh well, tomorrows problem.
-
-For now we can do this: (javascript)
+And it is a slice :D
+
+add github as a gem source
+
+ sudo gem install collin-merb_javascript_named_routes
+
+cd to a merb app
+edit config/dependencies
+
+ dependency "collin-merb_javascript_named_routes"
+
+ rake slices:merb_javascript_named_routes:install
+
+edit config/router
+
+ slice(:merb_javascript_named_routes, :name_prefix => nil, :path_prefix => "")
+
+edit some view or application layout (haml)
+
+ %script{:src => url(:routes) }
+
+Go load up firebug :)
+
+Now we can do this: (javascript)
>> url(:blogs)
=> '/blogs'
Binary file not shown.

0 comments on commit a5fcabb

Please sign in to comment.