Class: CarrierWaveDirect::FormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Defined in:
lib/carrierwave_direct/form_builder.rb

Instance Method Summary collapse

Instance Method Details

#content_type_label(content = nil) ⇒ Object



23
24
25
26
# File 'lib/carrierwave_direct/form_builder.rb', line 23

def content_type_label(content=nil)
  content ||= 'Content Type'
  @template.label_tag('Content-Type', content)
end

#content_type_select(choices = [], selected = nil, options = {}) ⇒ Object



28
29
30
# File 'lib/carrierwave_direct/form_builder.rb', line 28

def content_type_select(choices = [], selected = nil, options = {})
  @template.select_tag('Content-Type', content_choices_options(choices, selected), options)
end

#fields_except_file_field(options = {}) ⇒ Object



17
18
19
20
21
# File 'lib/carrierwave_direct/form_builder.rb', line 17

def fields_except_file_field(options = {})
  @object.policy(enforce_utf8: true)

  hidden_fields(options)
end

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



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/carrierwave_direct/form_builder.rb', line 5

def file_field(method, options = {})
  @object.policy(enforce_utf8: true)

  fields = hidden_fields(options)

  # The file field must be the last element in the form.
  # Any element after this will be ignored by Amazon.
  options.merge!(:name => "file")

  fields << super
end