Class: Terror::Post
- Inherits:
-
Object
- Object
- Terror::Post
- Includes:
- DataMapper::Resource, FeedFetcher
- Defined in:
- lib/terror/post.rb
Class Method Summary collapse
Methods included from FeedFetcher
Class Method Details
.paginate(options = {}) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/terror/post.rb', line 14 def self.paginate( = {}) per_page = [:per_page] page = [:page].to_i > 0 ? [:page].to_i : 1 posts = self.all(:order => [:date.desc], :limit => per_page, :offset => per_page * (page - 1)) add_pagination_info(posts, per_page, page) end |