Skip to content

Instantly share code, notes, and snippets.

@UsamaAshraf
Created May 23, 2021 16:50
Show Gist options
  • Save UsamaAshraf/b5aa6e13e0fe782e891d341ce0176392 to your computer and use it in GitHub Desktop.
Save UsamaAshraf/b5aa6e13e0fe782e891d341ce0176392 to your computer and use it in GitHub Desktop.
class PostsController < ApplicationController
def index
# Runs a SQL join with the users table.
posts = Post.includes(:author).all
render json: posts
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment