Class: CaringForm::Field::Dummy

Inherits:
Base
  • Object
show all
Defined in:
lib/caring_form/field/dummy.rb

Instance Attribute Summary

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Base

#default_label, #initialize, register, #render

Constructor Details

This class inherits a constructor from CaringForm::Field::Base

Instance Method Details

#apply_to_model(klass) ⇒ Object



12
13
14
# File 'lib/caring_form/field/dummy.rb', line 12

def apply_to_model(klass)
  klass.send(:attr_accessor, name)
end

#input_properties(form, options = {}) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/caring_form/field/dummy.rb', line 20

def input_properties(form, options = {})
  super.tap do |req|
    req[:wrapper_html][:class] = "form_add #{req[:wrapper_html][:class]}".strip
    req[:wrapper_tag] = 'div'
    # don't require the field on the client side, it's a dummy
    req[:input_html][:required] = nil
  end
end

#optionalObject



16
17
18
# File 'lib/caring_form/field/dummy.rb', line 16

def optional
  true
end

#simple_typeObject



8
9
10
# File 'lib/caring_form/field/dummy.rb', line 8

def simple_type
  :string
end