Skip to content

Commit

Permalink
Improved decimal logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Mar 20, 2023
1 parent 18271ca commit 65e7240
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/lockbox/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,10 @@ def reload
# Postgres stores 4 decimal digits in 2 bytes
# plus 3 to 8 bytes of overhead
# but use string for simplicity
if ActiveRecord::VERSION::MAJOR >= 6
if message.is_a?(BigDecimal)
message = message.to_s("F")
else
# not always a BigDecimal with Active Record < 6
message = message.to_s
end
end
Expand Down

0 comments on commit 65e7240

Please sign in to comment.