Skip to content

Instantly share code, notes, and snippets.

@gcampbell391
Last active October 12, 2020 17:39
Show Gist options
  • Save gcampbell391/1a42ada81a827388a60e11c0b4756518 to your computer and use it in GitHub Desktop.
Save gcampbell391/1a42ada81a827388a60e11c0b4756518 to your computer and use it in GitHub Desktop.
class UsersController < ApplicationController
#Example of a common index route...Returns all users in json format
def index
users = User.all
render json: users, include: [:user_friends]
end
#This will be our custom add_friend action
def add_friend
#logic to add a friend
user = User.find(params[:id])
byebug
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment