Class: CaringForm::Field::Collection
- Inherits:
-
Base
- Object
- Struct
- Base
- CaringForm::Field::Collection
show all
- Defined in:
- lib/caring_form/field/collection.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
14
15
16
17
18
19
20
|
# File 'lib/caring_form/field/collection.rb', line 14
def apply_to_model(klass)
super
if (range = valid_values)
klass.send(:validates_inclusion_of, name, :allow_blank => true,
:in => range, :message => message)
end
end
|
22
23
24
25
26
|
# File 'lib/caring_form/field/collection.rb', line 22
def input_properties(form, options = {})
super.tap do |req|
req[:include_blank] = false
end
end
|
#simple_type ⇒ Object
10
11
12
|
# File 'lib/caring_form/field/collection.rb', line 10
def simple_type
self.as || :select
end
|