Class: AttachinaryInput
- Inherits:
-
SimpleForm::Inputs::Base
- Object
- SimpleForm::Inputs::Base
- AttachinaryInput
- Defined in:
- lib/attachinary/simple_form.rb
Instance Attribute Summary collapse
-
#attachinary_options ⇒ Object
readonly
Returns the value of attribute attachinary_options.
Instance Method Summary collapse
-
#initialize(builder, attribute_name, column, input_type, options = {}) ⇒ AttachinaryInput
constructor
A new instance of AttachinaryInput.
- #input ⇒ Object
Constructor Details
#initialize(builder, attribute_name, column, input_type, options = {}) ⇒ AttachinaryInput
Returns a new instance of AttachinaryInput.
4 5 6 7 8 9 |
# File 'lib/attachinary/simple_form.rb', line 4 def initialize(builder, attribute_name, column, input_type, = {}) @attachinary_options = builder.object.send("#{attribute_name.to_s.singularize}_options") attribute_name = @attachinary_options[:field_name] super builder, attribute_name, column, input_type, end |
Instance Attribute Details
#attachinary_options ⇒ Object (readonly)
Returns the value of attribute attachinary_options.
2 3 4 |
# File 'lib/attachinary/simple_form.rb', line 2 def @attachinary_options end |
Instance Method Details
#input ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/attachinary/simple_form.rb', line 11 def input name = "#{@builder.object_name}[#{attribute_name}]" value = object.send(attribute_name) template.attachinary_file_field_tag name, value, { html: , attachinary: } end |