diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-12 17:08:20 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-12 17:08:20 +0400 |
commit | c5b667351abcda4b5ac134873007a0ce47976e88 (patch) | |
tree | d72c2d04658447ec9d2d2d119e1b7d19635f0488 /app/models/broadcast_message.rb | |
parent | 963a31144b0d69af7b08e1912965a920636ce600 (diff) |
Show broadcast message to users
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/broadcast_message.rb')
-rw-r--r-- | app/models/broadcast_message.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb index 69636de90ef..5b0040f6ca3 100644 --- a/app/models/broadcast_message.rb +++ b/app/models/broadcast_message.rb @@ -4,4 +4,8 @@ class BroadcastMessage < ActiveRecord::Base validates :message, presence: true validates :starts_at, presence: true validates :ends_at, presence: true + + def self.current + where("ends_at > :now AND starts_at < :now", now: Time.zone.now).last + end end |