Newer
Older
class Communication::Block::Template::Post < Communication::Block::Template::Base
add_dependency [post.author, post.author.author]
@category ||= block.about&.website
.categories
.find_by(id: data['category_id'])
block.about&.website
.posts
.published
.ordered
.limit(quantity)
category_ids = [category.id, category.descendants.map(&:id)].flatten
university.communication_website_posts.joins(:categories)
.where(categories: { id: category_ids })
.distinct
def selected_posts_selection
block.about&.website
.posts
.published
.find_by(id: id)