-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
class FlatTax
include Mongoid::Document
field :r, :as => :rate, :type => BigDecimal
end
muichkine@ubuntu:~/src/white$ rails c -e test
Loading test environment (Rails 4.1.8)
2.1.4 :001 > rates = FlatTax.all.entries.map(&:rate)
=> #<BigDecimal:e92dcf0,'0.0',9(18)>, #<BigDecimal:e92dc50,'0.55E-1',9(18)>, #<BigDecimal:e92dbb0,'0.21E-1',9(18)>, #<BigDecimal:e92db10,'0.196E0',9(18)>, #<BigDecimal:e92da70,'0.7E-2',9(18)>, #<BigDecimal:e92d9d0,'0.2E0',9(18)>, #<BigDecimal:e92d930,'0.5E-1',9(18)>, #<BigDecimal:e92d840,'0.1E0',9(18)>
2.1.4 :002 > rates.map(&:to_f)
=> [0.0, 0.055, 0.021, 0.196, 0.007, 0.2, 0.05, 0.1]
2.1.4 :003 > FlatTax.where(:rate => BigDecimal('0.1')).entries
=> []