<NME> usher.rb
<BEF> # encoding: utf-8

begin
  require "usher"
rescue LoadError
  raise LoadError, "You have to install usher gem!"
end

Rango::Router.implement(:usher) do |env|
  module UrlHelper
    # url(:login)
    def url(*args)
      Project.router.router.generator.generate(*args)
    end
  end
end
      generator  = Rango::Router.app.router.generator
      route_name = args.shift
      route = generator.usher.named_routes[route_name]
      raise "No route found" if route.nil? # TODO: add RouteNotFound to usher and use it here as well
      if args.empty?
        generator.generate(route_name) # TODO: usher should probably have path.to_url
      else
        alts = route.paths.map(&:dynamic_keys) # one route can have multiple paths as /:id or /:id.:format
        keys = alts.first
        # FIXME: take a look at other alts as well !!!!
        # keys = alts.find.with_index { |item, index|  }

        # TODO: optional args
        keys_generator = keys.each
        args_generator = args.each
        opts = Hash.new

        keys.length.times do |index|
          key = keys_generator.next
          arg = args_generator.next
          if arg.respond_to?(key) # post instance
            opts[key] = arg.send(key)
          else # it's already a slug
            opts[key] = arg
          end
        end

        generator.generate(route_name, opts)
      end
    end
  end
end


# route = Rango::Router.app.router.generator.usher.named_routes[:admin_edit_sticker]
# p route.paths.map(&:dynamic_keys)

<MSG> Provide useful message if Project router is nil

<DFF> @@ -10,7 +10,8 @@ module Rango
   module UrlHelper
     # url(:login)
     def url(*args)
-      Project.router.router.generator.generate(*args)
+      raise "You have to asign your routes to Project.router, for example Project.router = Usher::Interface.for(:rack) { get('/') }" if Project.router.nil?
+      self.router.router.generator.generate(*args)
     end
   end
 end

Provide useful message if Project router is nil