Class: Ezframe::TelType
- Defined in:
- lib/ezframe/column_type.rb
Instance Attribute Summary
Attributes inherited from TypeBase
Instance Method Summary collapse
Methods inherited from TextType
Methods inherited from TypeBase
#db_type, #db_value, #form, #form_html, get_class, #initialize, #key, #label, #multi_inputs?, #no_edit?, #no_view?, type_name, #value, #value=, #view
Constructor Details
This class inherits a constructor from Ezframe::TypeBase
Instance Method Details
#normalize(val) ⇒ Object
424 425 426 427 428 429 430 |
# File 'lib/ezframe/column_type.rb', line 424 def normalize(val) return nil unless val val = super(val) val = val.tr("0-9", "0-9") val = val.gsub(/\D+/, "") return val end |
#validate(val) ⇒ Object
414 415 416 417 418 419 420 421 422 |
# File 'lib/ezframe/column_type.rb', line 414 def validate(val) super(val) return @error if @error unless /^0\d{9,10}$/ =~ val.to_s @error = :invalid_value return @error end return nil end |