diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-06-04 15:03:02 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-06-04 15:03:02 +0100 |
commit | a885764b65916020d9182073b38f6951a20d4b8c (patch) | |
tree | 0988651c144b65a8e46b28b376b2e72a5947d934 /app/models/censor_rule.rb | |
parent | eb1c465162420ad62c16dccb983cb28aa89a4639 (diff) | |
parent | a919141992a40599f99b32bd4a8312a0009f3f7a (diff) |
Merge branch 'release/0.11'0.11.0.3
Diffstat (limited to 'app/models/censor_rule.rb')
-rw-r--r-- | app/models/censor_rule.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb index f40ab6fbb..f0d06e088 100644 --- a/app/models/censor_rule.rb +++ b/app/models/censor_rule.rb @@ -20,7 +20,7 @@ # Stores alterations to remove specific data from requests. # # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ +# Email: hello@mysociety.org; WWW: http://www.mysociety.org/ class CensorRule < ActiveRecord::Base belongs_to :info_request @@ -33,13 +33,15 @@ class CensorRule < ActiveRecord::Base validate :require_valid_regexp, :if => proc{ |rule| rule.regexp? == true } validates_presence_of :text - named_scope :global, {:conditions => {:info_request_id => nil, - :user_id => nil, - :public_body_id => nil}} + scope :global, {:conditions => {:info_request_id => nil, + :user_id => nil, + :public_body_id => nil}} def require_user_request_or_public_body if self.info_request.nil? && self.user.nil? && self.public_body.nil? - errors.add("Censor must apply to an info request a user or a body; ") + [:info_request, :user, :public_body].each do |a| + errors.add(a, "Rule must apply to an info request, a user or a body") + end end end |