Skip to content

Instantly share code, notes, and snippets.

@superhighfives
Last active March 4, 2017 13:10
Show Gist options
  • Save superhighfives/11947f8a6fa44bd7f5f0677d08d06320 to your computer and use it in GitHub Desktop.
Save superhighfives/11947f8a6fa44bd7f5f0677d08d06320 to your computer and use it in GitHub Desktop.
Rails 5 API + ActiveAdmin + create-react-app on Heroku
class DrinksController < ApiController
# GET /drinks
def index
@drinks = Drink.select("id, title").all
render json: @drinks.to_json
end
# GET /drinks/:id
def show
@drink = Drink.find(params[:id])
render json: @drink.to_json(:include => { :ingredients => { :only => [:id, :description] }})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment