Add registrar vat rate

#623
This commit is contained in:
Artur Beljajev 2018-03-09 13:08:36 +02:00
parent 4f51f6c736
commit d6d20a81a9
5 changed files with 108 additions and 23 deletions

View file

@ -0,0 +1,19 @@
module Type
class VATRate < ActiveRecord::Type::Value
def type_cast_from_user(value)
if value.blank?
nil
else
super
end
end
def type_cast_from_database(value)
BigDecimal(value) * 100 if value
end
def type_cast_for_database(value)
BigDecimal(value) / 100.0 if value
end
end
end