* Refactored the favorites code a bit. Adding a favorite from either an user or a post now works and will update all necessary records.
31 lines
489 B
Ruby
31 lines
489 B
Ruby
# This only works with the numbered paginator because of the way
|
|
# the association is stored.
|
|
module PostSets
|
|
module Pool
|
|
def pool
|
|
@pool ||= ::Pool.find(params[:id])
|
|
end
|
|
|
|
def tags
|
|
["pool:#{pool.name}"]
|
|
end
|
|
|
|
def has_wiki?
|
|
true
|
|
end
|
|
|
|
def count
|
|
pool.post_count
|
|
end
|
|
|
|
def posts
|
|
@posts ||= pool.posts(pagination_options).limit(limit).all
|
|
end
|
|
|
|
def reload
|
|
super
|
|
@pool = nil
|
|
end
|
|
end
|
|
end
|