Module: Voltron::Upload::Field

Includes:
ActionView::Helpers::TagHelper
Defined in:
lib/voltron/upload/action_view/field.rb

Defined Under Namespace

Classes: UploadField

Instance Method Summary collapse

Instance Method Details

#file_field(method, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/voltron/upload/action_view/field.rb', line 7

def file_field(method, options={})
  if Voltron.config.upload.enabled && !options[:default]
    template = instance_variable_get('@template')
    field = UploadField.new(@object, method, template, options)

    # +merge+ is because options is a hash with_indifferent_access, and will therefore have an 'object' attribute when converted to html
    #super method, {}.merge(field.options)
     'v-upload', nil, field.options
  else
    options.delete(:default)
    super method, options
  end
end