* Some major bug fixes related to post sets. Tests for pools and favorites were added.
* Refactored the favorites code a bit. Adding a favorite from either an user or a post now works and will update all necessary records.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
module PostSets
|
||||
module Favorite
|
||||
def user
|
||||
@user ||= User.find(params[:id])
|
||||
@user ||= ::User.find(params[:id])
|
||||
end
|
||||
|
||||
def tags
|
||||
@@ -19,11 +19,15 @@ module PostSets
|
||||
end
|
||||
|
||||
def count
|
||||
@count ||= Favorite.count(user.id)
|
||||
@count ||= relation.count
|
||||
end
|
||||
|
||||
def posts
|
||||
@posts ||= user.favorites(pagination_options)
|
||||
@posts ||= slice(relation).map(&:post)
|
||||
end
|
||||
|
||||
def relation
|
||||
::Favorite.model_for(user.id).where("user_id = ?", user.id).order("id desc")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user