Skip to content

Instantly share code, notes, and snippets.

View superhighfives's full-sized avatar

Charlie Gleason superhighfives

View GitHub Profile
@superhighfives
superhighfives / Gemfile
Last active February 28, 2017 19:47
Rails 5 API + ActiveAdmin + create-react-app on Heroku
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
@superhighfives
superhighfives / Gemfile
Created March 2, 2017 18:01
Rails 5 API + ActiveAdmin + create-react-app on Heroku
group :development do
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'foreman', '~> 0.82.0'
end
@superhighfives
superhighfives / drinks_controller.rb
Last active March 2, 2017 18:05
Rails 5 API + ActiveAdmin + create-react-app on Heroku
class DrinksController < ApplicationController
def show
render json: {
title: "Sparkling Negroni",
ingredients: [
"⅓ oz. Campari",
"⅓ oz. gin",
"⅓ oz. sweet vermouth",
"Chilled prosecco, or other sparkling wine, for topping",
"Orange peel twist (optional)"
@superhighfives
superhighfives / package.json
Last active March 2, 2017 18:06
Rails 5 API + ActiveAdmin + create-react-app on Heroku
{
"name": "list-of-ingredients",
"engines": {
"node": "6.3.1"
},
"scripts": {
"build": "cd client && npm install && npm run build && cd ..",
"deploy": "cp -a client/build/. public/",
"postinstall": "npm run build && npm run deploy && echo 'Client built!'"
}
@superhighfives
superhighfives / application.rb
Last active March 2, 2017 18:06
Rails 5 API + ActiveAdmin + create-react-app on Heroku
require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
@superhighfives
superhighfives / error
Created March 2, 2017 18:40
Rails 5 API + ActiveAdmin + create-react-app on Heroku
$ bin/rails g scaffold drink
Running via Spring preloader in process 38277
Expected string default value for '--serializer'; got true (boolean)
invoke active_record
create db/migrate/20170302183027_create_drinks.rb
create app/models/drink.rb
invoke test_unit
create test/models/drink_test.rb
create test/fixtures/drinks.yml
invoke resource_route
@superhighfives
superhighfives / package.json
Last active March 2, 2017 23:39
Rails 5 API + ActiveAdmin + create-react-app on Heroku
{
"name": "client",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:3001",
"devDependencies": {
"react-scripts": "0.9.0",
},
"dependencies": {
"react": "^15.4.2",
@superhighfives
superhighfives / application.rb
Last active March 2, 2017 23:57
Rails 5 API + ActiveAdmin + create-react-app on Heroku
require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
@superhighfives
superhighfives / drink.rb
Created March 2, 2017 23:58
Rails 5 API + ActiveAdmin + create-react-app on Heroku
class Drink < ApplicationRecord
has_many :ingredients
end
@superhighfives
superhighfives / routes.rb
Last active March 3, 2017 00:12
Rails 5 API + ActiveAdmin + create-react-app on Heroku
Rails.application.routes.draw do
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
scope '/api' do
resources :drinks
end
end