major refactoring of post sets and pagination, incomplete

This commit is contained in:
albert
2011-06-03 19:47:16 -04:00
parent ce0695c606
commit ca3e9bb6db
21 changed files with 475 additions and 204 deletions

View File

@@ -1,18 +1,29 @@
module PostSets
class Favorite < Base
attr_accessor :user
def initialize(user)
@user = user
super()
module Favorite
def user
@user ||= User.find(params[:id])
end
def tags
"fav:#{user.name}"
@tags ||= ["fav:#{user.name}"]
end
def has_wiki?
false
end
def reload
super
@user = nil
@count = nil
end
def count
@count ||= Favorite.count(user.id)
end
def load_posts
@posts = user.favorite_posts(:before_id => before_id)
def posts
@posts ||= user.favorites(pagination_options)
end
end
end