aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/censor_rule.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/censor_rule.rb')
-rw-r--r--app/models/censor_rule.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb
index f40ab6fbb..ec66074b7 100644
--- a/app/models/censor_rule.rb
+++ b/app/models/censor_rule.rb
@@ -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