Skip to content

Instantly share code, notes, and snippets.

@jessecurry
Created February 3, 2014 23:11
Show Gist options
  • Save jessecurry/8794329 to your computer and use it in GitHub Desktop.
Save jessecurry/8794329 to your computer and use it in GitHub Desktop.
Respond to a custom HTTP method in a Rails App
Example::Application.routes.draw do
# TRIFORCE /youcant
match :youcant, to: "youcant#triforce", via: :triforce
end
# This will allow you to TRIFORCE
%w(triforce).each do |method|
ActionDispatch::Request::HTTP_METHODS << method.upcase
ActionDispatch::Request::HTTP_METHOD_LOOKUP[method.upcase] = method.to_sym
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment