How to add a route to the method 'options' for each controller?

Currently I’m mapping all of my controllers to use the same set of http
options in a controller called option

map.connect ‘*path’,
:controller => ‘option’,
:action => ‘options’,
:conditions => {:method => :options}

But I would like to know how to do something along these lines

map.connect ‘:controller*’,
:action => ‘options’,
:conditions => {:method => :options}

Which currently yields
Allow: GET, POST, PUT, DELETE
Status: 501 Not Implemented

The goal is that whenever a client application pre-flights a
cross-origin
request (CORS) the controller will issue the same options regardless of
the
action, but contingent upon the controller.

This is the options method which I would like to be able to control on a
per-controller basis:
def options
render :nothing => true, :status => 204
response.headers[‘Access-Control-Allow-Origin’] = ‘*’
response.headers[‘Access-Control-Allow-Methods’] = ‘POST, GET,
PUT,
DELETE, OPTIONS’
response.headers[‘Access-Control-Allow-Credentials’] = ‘true’
response.headers[‘Access-Control-Max-Age’] = ‘86400’
response.headers[‘Access-Control-Allow-Headers’] =
‘X-Requested-With,
X-HTTP-Method-Override, Content-Type, Accept’
end

AJ ONeal

I found the answer to my question and here’s a link to the other
thread:

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/29c8e6f4175b1676