Skip to content

Instantly share code, notes, and snippets.

@ajtack
Created May 19, 2009 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajtack/114112 to your computer and use it in GitHub Desktop.
Save ajtack/114112 to your computer and use it in GitHub Desktop.
Specifically enables the use of PUT and DELETE verbs in Rails forms. Rails' convention to override browsers' ignorance of these verbs is a hidden input field.
module Webrat
class Form
protected
def form_method
special_method = Webrat::XML.css_search(@element, 'input[name="_method"]').first
unless special_method.nil?
special_method['value']
else
Webrat::XML.attribute(@element, "method").blank? ? :get : Webrat::XML.attribute(@element, "method").downcase
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment