Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Customer < ActiveRecord::Base
- before_validation :extract_phone
- def phone
- read_attribute("phone").number_to_phone( value, :area_code => true, :delimiter => '-' )
- end
- protected
- def extract_phone=(val)
- write_attribute("phone", val.gsub!(\d+))
- end
- end
Add Comment
Please, Sign In to add comment