Module: ProtectedForm::Helpers
- Defined in:
- lib/protected_form/helpers.rb
Instance Method Summary collapse
Instance Method Details
#protected_form_for(*attrs, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/protected_form/helpers.rb', line 3 def protected_form_for *attrs, &block = attrs. id = 'pf_' + SecureRandom.hex(10) out = content_tag(:div, :id => id + '_form', :style => 'display:none;') do form_for(*attrs, .dup, &(Proc.new {})) end form_content = fields_for(*attrs, .dup, &block) out << content_tag(:div, form_content, :class => [:html][:class] + ' js-protected-form', :id => id) out.html_safe end |