daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module ActionView::Helpers::FormTagHelper
  2.  
  3.   def form_tag(url_for_options = {}, options = {}, &block)
  4.     html_options = html_options_for_form(url_for_options, options)
  5.     if block_given?
  6.       f = form_tag_in_block(html_options, &block)
  7.     else
  8.       f = form_tag_html(html_options)
  9.     end
  10.     hidden_f = ActiveSupport::SafeBuffer.new "<input name='n' type='hidden' value='v' /></form>"
  11.     f.gsub!(/</form>/, hidden_f)
  12.     f
  13.   end
  14.  
  15. end
  16.    
  17. ActionView::Template::Error (Could not concatenate to the buffer because it is not html safe.):
  18.    
  19. module ActionView::Helpers::FormTagHelper
  20.   alias_method :orig_extra_tags_for_form, :extra_tags_for_form
  21.  
  22.   def extra_tags_for_form(html_options)
  23.     orig_tags = orig_extra_tags_for_form(html_options)
  24.     orig_tags << "<input name='n' type='hidden' value='v' /></form>".html_safe
  25.   end
  26. end
  27.    
  28. module ActionView::Helpers::FormTagHelper
  29.   def form_tag(url_for_options = {}, options = {}, &block)
  30.     html_options = html_options_for_form(url_for_options, options)
  31.     if block_given?
  32.       f = form_tag_in_block(html_options, &block)
  33.     else
  34.       f = form_tag_html(html_options)
  35.     end
  36.     hidden_f = ActiveSupport::SafeBuffer.new "<input name='n' type='hidden' value='v' /></form>"
  37.     f.gsub!(/</form>/, hidden_f)
  38.     f.html_safe
  39.   end
  40. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top