我对红宝石比较陌生。这个可以晒干吗?如何?
def primary_phone
number_to_phone self.primary_phone_number
end
def primary_phone=(number)
self.primary_phone_number = number.gsub(/\D/, '')
end
def secondary_phone
number_to_phone self.secondary_phone_number
end
def secondary_phone=(number)
self.secondary_phone_number = number.gsub(/\D/, '')
end
def fax
number_to_phone self.fax_phone_number
end
def fax=(number)
self.fax_phone_number = number.gsub(/\D/, '')
end
我在 Rails 中使用此代码作为数据库之间的一种缓冲区,数据库将数字存储为整数,用户表单将它们作为字符串输入。