class PostsController < ApplicationController
def index
posts = Post.for_feed.page(params[:page]).per(25)
render json: {
data: posts.map { |post| PostSerializer.new(post).as_json },
class ArticlesController < ApplicationController
def index
# Bounded queries: without preload, article.author in the view raises.
@articles = Article
.published
.preload(:author, :tags)