lib/usher/interface/rails2_2_interface.rb in usher-0.4.8 vs lib/usher/interface/rails2_2_interface.rb in usher-0.5.1

- old
+ new

@@ -10,12 +10,11 @@ def initialize reset! end def reset! - @usher ||= Usher.new - @url_generator ||= Usher::Generators::URL.new(@usher) + @usher ||= Usher.new(:generator => Usher::Util::Generators::URL.new) @module ||= Module.new @module.instance_methods.each do |selector| @module.class_eval { remove_method selector } end @controller_action_route_added = false @@ -36,11 +35,11 @@ options[:action] = 'index' unless options[:action] path[0, 0] = '/' unless path[0] == ?/ route = @usher.add_route(path, 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 recognize(request) node = @usher.recognize(request) @@ -84,10 +83,10 @@ raise "method #{method} not recognized" end end def generate_url(route, params) - @url_generator.generate(route, params) + @usher.generator.generate(route, params) end def path_for_options(options) @usher.path_for_options(options) end