Sha256: ef11229043f499d5ffbecd6ac41133d82408f8ceb7203f7498c9601fbc7d9fc5
Contents?: true
Size: 291 Bytes
Versions: 1
Compression:
Stored size: 291 Bytes
Contents
class MoneyType < ActiveRecord::Type::Integer def cast(value) if !value.is_a?(Numeric) && value.include?('$') price_in_dollars = value.delete('$').to_f super(price_in_dollars * 100) else super end end end ActiveModel::Type.register(:money_type, MoneyType)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
store_attribute-0.5.0 | spec/support/money_type.rb |