lib/usher/interface/rails2_3_interface.rb in usher-0.5.10 vs lib/usher/interface/rails2_3_interface.rb in usher-0.5.11

- old
+ new

@@ -69,19 +69,22 @@ request.path_parameters = (response.params.empty? ? response.path.route.destination : response.path.route.destination.merge(response.params.inject({}){|h,(k,v)| h[k]=v; h })).with_indifferent_access response.params.each { |pair| request.path_parameters[pair.first] = pair.last } "#{request.path_parameters[:controller].camelize}Controller".constantize end - def reset! - @router = Usher.new(:generator => Usher::Util::Generators::URL.new, :request_methods => [:protocol, :domain, :port, :query_string, :remote_ip, :user_agent, :referer, :method, :subdomains]) + def reset!(options={}) + options[:generator] = options[:generator] || Usher::Util::Generators::URL.new + options[:request_methods] = options[:request_methods] || [:protocol, :domain, :port, :query_string, :remote_ip, :user_agent, :referer, :method, :subdomains] + + @router = Usher.new(options) @configuration_files = [] @module ||= Module.new @controller_route_added = false @controller_action_route_added = false end - def draw - reset! + def draw(options={}) + reset!(options) yield ActionController::Routing::RouteSet::Mapper.new(self) install_helpers end def install_helpers(destinations = [ActionController::Base, ActionView::Base], regenerate_code = false)