lib/padrino-routing.rb in padrino-routing-0.1.3 vs lib/padrino-routing.rb in padrino-routing-0.1.4

- old
+ new

@@ -30,20 +30,20 @@ original, @_namespace = @_namespace, name self.class_eval(&block) @_namespace = original end - # Hijacking route method in sinatra to replace a route alias (i.e :account) with the full url string mapping + # Hijacking route method in Sinatra to replace a route alias (i.e :account) with the full url string mapping # Supports namespaces by accessing the instance variable and appending this to the route alias name # If the path is not a symbol, nothing is changed and the original route method is invoked def route(verb, path, options={}, &block) if path.kind_of?(Symbol) route_name = [@_namespace, path].flatten.compact if mapped_url = options.delete(:map) # constructing named route map(*route_name).to(mapped_url) path = mapped_url else # referencing prior named route - route_name.unshift(self.app_name) + route_name.unshift(self.app_name.to_sym) path = named_paths[route_name] end end raise RouteNotFound.new("Route alias #{route_name.inspect} is not mapped to a url") unless path super verb, path, options, &block