class CustomAttributes::IntFieldType
Public Instance Methods
cast_single_value(custom_field, value, customized=nil)
click to toggle source
# File lib/custom_attributes/field_types/int_field_type.rb, line 9 def cast_single_value(custom_field, value, customized=nil) value.to_i end
label()
click to toggle source
# File lib/custom_attributes/field_types/int_field_type.rb, line 5 def label "label_integer" end
validate_single_value(custom_field, value, customizable = nil)
click to toggle source
Calls superclass method
# File lib/custom_attributes/field_types/int_field_type.rb, line 13 def validate_single_value(custom_field, value, customizable = nil) errs = super errs << ::I18n.t('activerecord.errors.messages.not_a_number') unless value.to_s =~ /^[+-]?\d+$/ errs end