diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2015-11-18 14:25:37 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2015-11-18 15:05:45 +0300 |
commit | 01620dd7e7f3015e31ac0288ef71fcfc4f268a14 (patch) | |
tree | 0cd21ca4e405070e54d24888cb79ff0ae564be04 /app/models/event.rb | |
parent | fbcf3bd3fc94a39982e2bb11aa61ac014326e53a (diff) |
Added Event.limit_recent
This will be used to move some querying logic from the users controller
to the Event model (where it belongs).
Diffstat (limited to 'app/models/event.rb')
-rw-r--r-- | app/models/event.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/event.rb b/app/models/event.rb index 7618b503d84..9afd223bce5 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -69,6 +69,10 @@ class Event < ActiveRecord::Base row ? row.updated_at : nil end + + def limit_recent(limit = 20, offset = nil) + recent.limit(limit).offset(offset) + end end def proper? |