lib/usher/interface/rails2_3_interface.rb in usher-0.4.8 vs lib/usher/interface/rails2_3_interface.rb in usher-0.5.1
- old
+ new
@@ -26,11 +26,11 @@
options[:action] = 'index' unless options[:action]
path[0, 0] = '/' unless path[0] == ?/
route = @router.add_route(path, options).to(options)
- raise "your route must include a controller" unless (route.paths.first.dynamic_keys.include?(:controller) || route.destination.include?(:controller))
+ raise "your route must include a controller" unless (route.paths.first.dynamic_keys && route.paths.first.dynamic_keys.include?(:controller)) || route.destination.include?(:controller)
route
end
def initialize
reset!
@@ -70,12 +70,11 @@
response.params.each { |pair| request.path_parameters[pair.first] = pair.last }
"#{request.path_parameters[:controller].camelize}Controller".constantize
end
def reset!
- @router = Usher.new
- @url_generator = Usher::Generators::URL.new(@router)
+ @router = Usher.new(:generator => Usher::Util::Generators::URL.new)
@configuration_files = []
@module ||= Module.new
@controller_route_added = false
@controller_action_route_added = false
end
@@ -121,10 +120,10 @@
raise "method #{method} not recognized"
end
end
def generate_url(route, params)
- @url_generator.generate(route, params)
+ @router.generator.generate(route, params)
end
def path_for_options(options)
@router.path_for_options(options)
end
\ No newline at end of file