Skip to content

Instantly share code, notes, and snippets.

@mryoshio
Created September 5, 2013 02:12
Show Gist options
  • Save mryoshio/6445258 to your computer and use it in GitHub Desktop.
Save mryoshio/6445258 to your computer and use it in GitHub Desktop.
Have rails respond to HTTP OPTIONS method.
# Implementation for HTTP OPTIONS method in rails 3.2.13
# inspired by https://gist.github.com/ajturner/832700
# routes.rb
match '/*any_path', :controller => 'application', :action => 'method_for_options_method', :constraints => { :method => 'OPTIONS' }
# application_controller.rb
def method_for_options_method
render :nothing => true, :status => 200
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment