Mercurial > hg > soundsoftware-site
diff app/models/.svn/text-base/journal_detail.rb.svn-base @ 514:7eba09d624db live
Merge
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2011 10:50:53 +0100 |
parents | cbce1fd3b1b7 |
children |
line wrap: on
line diff
--- a/app/models/.svn/text-base/journal_detail.rb.svn-base Thu Jul 14 10:46:20 2011 +0100 +++ b/app/models/.svn/text-base/journal_detail.rb.svn-base Thu Jul 14 10:50:53 2011 +0100 @@ -1,5 +1,5 @@ -# redMine - project management software -# Copyright (C) 2006 Jean-Philippe Lang +# Redmine - project management software +# Copyright (C) 2006-2011 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -17,9 +17,22 @@ class JournalDetail < ActiveRecord::Base belongs_to :journal + before_save :normalize_values - def before_save - self.value = value[0..254] if value && value.is_a?(String) - self.old_value = old_value[0..254] if old_value && old_value.is_a?(String) + 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