diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/censor_rule.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb index a0606c4f8..b064a13f3 100644 --- a/app/models/censor_rule.rb +++ b/app/models/censor_rule.rb @@ -21,7 +21,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: censor_rule.rb,v 1.2 2008-10-28 13:04:20 francis Exp $ +# $Id: censor_rule.rb,v 1.3 2008-12-04 19:23:07 francis Exp $ class CensorRule < ActiveRecord::Base belongs_to :info_request @@ -29,10 +29,16 @@ class CensorRule < ActiveRecord::Base belongs_to :public_body def apply_to_text(text) + if text.nil? + return nil? + end text.gsub!(self.text, self.replacement) return text end def apply_to_binary(binary) + if binary.nil? + return nil? + end replacement = self.text.gsub(/./, 'x') binary.gsub!(self.text, replacement) return binary |