lib/usher/interface/rails2_interface.rb in joshbuddy-usher-0.2.0 vs lib/usher/interface/rails2_interface.rb in joshbuddy-usher-0.2.1
- old
+ new
@@ -41,12 +41,12 @@
raise "your route must include a controller" unless route.primary_path.dynamic_set.include?(:controller) || route.params.include?(:controller)
route
end
def recognize(request)
- (path, params_list) = @usher.recognize(request)
- params = params_list.inject({}){|h,(k,v)| h[k]=v; h }
- request.path_parameters = (params_list.empty? ? path.route.params : path.route.params.merge(params)).with_indifferent_access
+ node = @usher.recognize(request)
+ params = node.params.inject({}){|h,(k,v)| h[k]=v; h }
+ request.path_parameters = (node.params.empty? ? node.path.route.params : node.path.route.params.merge(params)).with_indifferent_access
"#{request.path_parameters[:controller].camelize}Controller".constantize
rescue
raise ActionController::RoutingError, "No route matches #{request.path.inspect} with #{request.inspect}"
end