Class: PrettyFileInputInput

Inherits:
SimpleForm::Inputs::Base
  • Object
show all
Defined in:
app/inputs/pretty_file_input_input.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options) ⇒ Object



2
3
4
5
6
7
8
9
# File 'app/inputs/pretty_file_input_input.rb', line 2

def input(wrapper_options)
  @builder.multipart = true
  PrettyFileInput::Views::Component.new(
    name: tag_name,
    persisted: object.try(:persisted?),
    filename: object.try(:send, attribute_name).try(:file).try(:filename)
  ).to_html
end

#tag_nameObject

Not sure why this is so goddamn hard to retrieve



12
13
14
15
# File 'app/inputs/pretty_file_input_input.rb', line 12

def tag_name
  ActionView::Helpers::Tags::Base.new(object_name, attribute_name, nil).
    send(:tag_name)
end