すべてのフォーム タグに隠しフィールドを追加することは可能ですか? 私は次の方法でそれをやろうとしています:
module ActionView::Helpers::FormTagHelper
def form_tag(url_for_options = {}, options = {}, &block)
html_options = html_options_for_form(url_for_options, options)
if block_given?
f = form_tag_in_block(html_options, &block)
else
f = form_tag_html(html_options)
end
hidden_f = ActiveSupport::SafeBuffer.new "<input name='n' type='hidden' value='v' /><\/form>"
f.gsub!(/<\/form>/, hidden_f)
f
end
end
しかし、サーバーはエラーを示しています:
ActionView::Template::Error (Could not concatenate to the buffer because it is not html safe.):
どうすればいいですか?