Class: CaringForm::Field::Tel
- Inherits:
-
Base
- Object
- Struct
- Base
- CaringForm::Field::Tel
show all
- Defined in:
- lib/caring_form/field/tel.rb
Instance Attribute Summary
Attributes inherited from Base
#name
Instance Method Summary
collapse
Methods inherited from Base
#default_label, #initialize, register, #render
Instance Method Details
#apply_to_model(klass) ⇒ Object
12
13
14
15
16
|
# File 'lib/caring_form/field/tel.rb', line 12
def apply_to_model(klass)
super
klass.send(:validates_format_of, name, :allow_blank => true,
:with => regexp, :message => message, :multiline => true)
end
|
18
19
20
21
22
23
24
|
# File 'lib/caring_form/field/tel.rb', line 18
def input_properties(form, options = {})
super.tap do |req|
req[:input_html][:pattern] ||= regexp.source
req[:input_html][:title] ||= message
req[:input_html][:type] ||= 'tel'
end
end
|
#simple_type ⇒ Object
8
9
10
|
# File 'lib/caring_form/field/tel.rb', line 8
def simple_type
:string
end
|