Class: ContentsCore::ItemFloat
- Inherits:
-
Item
show all
- Defined in:
- app/models/contents_core/item_float.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Item
#as_json, #attr_id, #class_name, #config, #data_type, #editable, #on_after_initialize, #on_before_create, #opt_input, #process_data, #set, #to_s, types, #validate_item
Class Method Details
.permitted_attributes ⇒ Object
15
16
17
|
# File 'app/models/contents_core/item_float.rb', line 15
def self.permitted_attributes
[ :data_float ]
end
|
.type_name ⇒ Object
19
20
21
|
# File 'app/models/contents_core/item_float.rb', line 19
def self.type_name
'float'
end
|
Instance Method Details
#init ⇒ Object
5
6
7
8
|
# File 'app/models/contents_core/item_float.rb', line 5
def init
self.data = 0 unless self.data
self
end
|
#update_data(value) ⇒ Object
10
11
12
13
|
# File 'app/models/contents_core/item_float.rb', line 10
def update_data( value )
self.data = value.to_f
self.save
end
|