diff options
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 |