Module: ActsAsSecurelyTransferable::FormHelper

Defined in:
lib/acts_as_securely_transferable/form_helper.rb

Instance Method Summary collapse

Instance Method Details

#securely_transferable_form_for(*args, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/acts_as_securely_transferable/form_helper.rb', line 3

def securely_transferable_form_for(*args, &block)
  options = args.last.is_a?(Hash) ? args.pop : { }
  options = options.merge({ :html => { :onsubmit => 'return ActsAsSecurelyTransferable.encryptForm(this);' } })
  form_for args, options do |f|
    concat f.hidden_field(:public_modulus)
    concat f.hidden_field(:public_exponent)
    for field in f.object_name.camelize.constantize.secure_fields
      concat f.hidden_field("#{field}_encrypted")
    end
    block.call(f)
  end
end