Skip to content
Browse files

only expand path if file can be detected. happens if caller_files is …

…empty.
  • Loading branch information...
1 parent 9d978b7 commit 9da48bc4656dc59e2739a5b4bf01ce4437987818 @rkh committed Jul 16, 2010
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/sinatra/advanced_routes.rb
View
3 lib/sinatra/advanced_routes.rb
@@ -125,8 +125,9 @@ def get(path, opts={}, &block)
def route(verb, path, options={}, &block)
file, line = block.source_location if block.respond_to? :source_location
file ||= caller_files.first
+ file &&= file.expand_path
route = super(verb, path, options, &block)
- route.to_route! verb, :app => self, :file => file.expand_path, :line => line, :path => path
+ route.to_route! verb, :app => self, :file => file, :line => line, :path => path
invoke_hook :advanced_route_added, route
@capture_routes << route if @capture_routes
route

0 comments on commit 9da48bc

Please sign in to comment.
Something went wrong with that request. Please try again.