Created
June 20, 2013 21:59
-
-
Save carlosipe/5827086 to your computer and use it in GitHub Desktop.
form_tag padrino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def form_tag(url, options={}, &block) | |
| desired_method = options[:method].to_s | |
| options.delete(:method) unless desired_method =~ /get|post/i | |
| options.reverse_merge!(:method => 'post', :action => url) | |
| options[:enctype] = 'multipart/form-data' if options.delete(:multipart) | |
| options['accept-charset'] ||= 'UTF-8' | |
| inner_form_html = hidden_form_method_field(desired_method) | |
| inner_form_html << csrf_token_field unless desired_method =~ /get/i | |
| inner_form_html << mark_safe(capture_html(&block)) | |
| concat_content content_tag(:form, inner_form_html, options) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment