projects
/
rails.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Improve blocks on/by links on user pages
[rails.git]
/
app
/
models
/
user_block.rb
diff --git
a/app/models/user_block.rb
b/app/models/user_block.rb
index 8821926bbd3b73a8cb37af6c09dbdd0722326239..2cf0eefc419fd3770c2c339819ac1beb56d1f169 100644
(file)
--- a/
app/models/user_block.rb
+++ b/
app/models/user_block.rb
@@
-9,6
+9,12
@@
class UserBlock < ActiveRecord::Base
PERIODS = USER_BLOCK_PERIODS
+ ##
+ # scope to match active blocks
+ def self.active
+ self.where("needs_view or ends_at > ?", Time.now.getutc)
+ end
+
##
# return a renderable version of the reason text.
def reason