summaryrefslogtreecommitdiffstats
path: root/app/models/journal_detail.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/journal_detail.rb')
-rw-r--r--app/models/journal_detail.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/journal_detail.rb b/app/models/journal_detail.rb
index aa22e6f71..886fe3eb4 100644
--- a/app/models/journal_detail.rb
+++ b/app/models/journal_detail.rb
@@ -17,4 +17,22 @@
class JournalDetail < ActiveRecord::Base
belongs_to :journal
+ before_save :normalize_values
+
+ private
+
+ def normalize_values
+ self.value = normalize(value)
+ self.old_value = normalize(old_value)
+ end
+
+ def normalize(v)
+ if v == true
+ "1"
+ elsif v == false
+ "0"
+ else
+ v
+ end
+ end
end