# Request Routing Plugin Update - Feedback? Interest? Help?

**URL:** <https://www.ruby-forum.com/t/request-routing-plugin-update-feedback-interest-help/105358>\
**Category:** Rails\
**Created:** [May 29, 2007, 9:10am UTC](https://www.ruby-forum.com/t/request-routing-plugin-update-feedback-interest-help/105358 "2007-05-29T09:10:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![davis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e19adc/32.png) [@davis](https://www.ruby-forum.com/u/davis)\
**Post date:** [May 29, 2007, 9:10am UTC](https://www.ruby-forum.com/t/request-routing-plugin-update-feedback-interest-help/105358/1 "2007-05-29T09:10:05Z")

</div>

I have an update to the request plugin that I would like feedback or  
help with. I have contacted the author but have not heard anything  
back, which is why I am posting this here.

My goal was to allow for sites that could have unlimited user  
subdomains, but would like to reserve some subdomains for other uses.  
To do this I changed the plugin to allow for either multiple  
subdomains or to exclude single or multiple subdomains (or domains).  
It works pretty well (but could be cleaned up, I am not a great ruby  
coder, still pretty new).

Below is the code, please let me know if I can approve it ( I did try  
a case/switch statement, but it always seemed to throw and error in  
the routes):

module ActionController  
module Routing  
class Route

```
  TESTABLE_REQUEST_METHODS =

```

[:subdomain, :domain, :method, :port, :remote\_ip,  
:content\_type, :accepts, :request\_uri,  
:protocol,  
:exclude\_subdomain, :exclude\_domain ]

```
  def recognition_conditions
    result = ["(match =

```

#{Regexp.new(recognition\_pattern).inspect}.match(path))"]  
conditions.each do |method, value|  
if TESTABLE\_REQUEST\_METHODS.include? method  
if method.to\_s[0,7] === ‘exclude’  
prefix = “!”  
env\_name =  
method.to\_s[8,method.to\_s.length-8].to\_sym.inspect  
else  
prefix =""  
env\_name = method.inspect  
end  
condition\_name = method.inspect  
result \<\< “conditions[#{condition\_name}] =~  
env[#{env\_name}]” if value.is\_a? Regexp  
result \<\< “#{prefix}conditions[#{condition\_name}].include?  
(env[#{env\_name}])” if value.is\_a? Array  
result \<\< “conditions[#{condition\_name}] ===  
env[#{env\_name}]” if !value.is\_a?(Regexp) && !value.is\_a?(Array)  
else  
end  
end  
result  
end  
end

```
class RouteSet

  def extract_request_environment(request)
    {
      :method => request.method,
      :subdomain => request.subdomains.first.to_s,
      :domain => request.domain,
      :port => request.port,
      :remote_ip => request.remote_ip,
      :content_type => request.content_type,
      :accepts => request.accepts.map(&:to_s).join(','),
      :request_uri => request.request_uri,
      :protocol => request.protocol
    }
  end

end

```

end  
end
