问题
I want to add custom http VERB to rails 4 here is my routes.rb
ring "/session/" => "calls#ringing"
and I also puts this code to initializers
%w(ring busy).each do |method|
ActionDispatch::Request::HTTP_METHODS << method.upcase
ActionDispatch::Request::HTTP_METHOD_LOOKUP[method.upcase] = method.to_sym
end
When I try to start application I have this error.
undefined method `ring' for #<ActionDispatch::Routing::Mapper:0x000000035c4150>
I really need to use this custom verb "RING".
回答1:
I fixed the problem by adding to routes this string
match '/session/:sessionid', :to => 'calls#initiate', :via => :ring
来源:https://stackoverflow.com/questions/18065443/how-to-add-custom-verb-http-request-method-to-rails4