Last active
March 4, 2017 13:10
-
-
Save superhighfives/11947f8a6fa44bd7f5f0677d08d06320 to your computer and use it in GitHub Desktop.
Rails 5 API + ActiveAdmin + create-react-app on Heroku
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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