Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# This is an attempt at an improved version of params_for or rspec rails. It is meant to
# support recognition of paths when the Rails environment has been extended via patches like these:
# http://weblog.jamisbuck.org/2006/10/26/monkey-patching-rails-extending-routes-2
# http://svn.danwebb.net/external/rails/plugins/request_routing/trunk/README
# So instead of route :conditions having only :method, they may now have other data such as :domain
def recognize_path( path, options)
if options[:host].kind_of?( Array )
result = options[:host].collect{ | h | route( path, options.merge( :host => h) ) }
else
begin
# This doesn't quite work since unfortunately, extract_request_environment hasn't been
# invoked yet!
result = ActionController::Routing::Routes.recognize_path( path, options)
rescue ActionController::RoutingError
end
end
result
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.