Skip to content

Commit

Permalink
now a gem
Browse files Browse the repository at this point in the history
  • Loading branch information
collin committed Feb 2, 2009
1 parent b1b5d98 commit a5fcabb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions README
Expand Up @@ -17,20 +17,30 @@ No. Not anymore.


For I have written a naive url writer in javascript. For I have written a naive url writer in javascript.


First we put it in our view: (erb) And it is a slice :D


<script src="/javascripts/url_writer.js"></script> add github as a gem source
<script>
Merb.compile_routes( sudo gem install collin-merb_javascript_named_routes
<%= Merb::Router.named_routes.to_json %>
,<%= Merb::Router.resource_routes.inject({}){|hash, rr| hash[rr.first.join(',')] = rr.last; hash}.to_json %> cd to a merb app
); edit config/dependencies
</script>

dependency "collin-merb_javascript_named_routes"
Oh god! How terrible. How nasty. How frail and brittle. Clearly this
will not stand the test of time. Oh well, tomorrows problem. rake slices:merb_javascript_named_routes:install


For now we can do this: (javascript) 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) >> url(:blogs)
=> '/blogs' => '/blogs'
Expand Down
Binary file added merb_javascript_named_routes-0.0.1.gem
Binary file not shown.

0 comments on commit a5fcabb

Please sign in to comment.