aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/comment.rb2
-rw-r--r--app/models/info_request.rb4
-rw-r--r--app/models/user.rb4
3 files changed, 8 insertions, 2 deletions
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 772bb3eda..59f91ffb7 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -33,6 +33,8 @@ class Comment < ActiveRecord::Base
validate :check_body_has_content,
:check_body_uses_mixed_capitals
+ scope :visible, where(:visible => true)
+
after_save :event_xapian_update
# When posting a new comment, use this to check user hasn't double
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index bdc9ec040..3ce0e3cd2 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -200,7 +200,9 @@ class InfoRequest < ActiveRecord::Base
OLD_AGE_IN_DAYS = 21.days
def visible_comments
- self.comments.find(:all, :conditions => 'visible')
+ warn %q([DEPRECATION] InfoRequest#visible_comments will be replaced with
+ InfoRequest#comments.visible as of 0.23).squish
+ comments.visible
end
# If the URL name has changed, then all request: queries will break unless
diff --git a/app/models/user.rb b/app/models/user.rb
index bb40dbc26..d50000aba 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -198,7 +198,9 @@ class User < ActiveRecord::Base
end
def visible_comments
- comments.find(:all, :conditions => 'visible')
+ warn %q([DEPRECATION] User#visible_comments will be replaced with
+ User#comments.visible as of 0.23).squish
+ comments.visible
end
# Don't display any leading/trailing spaces