Skip to content

Instantly share code, notes, and snippets.

@elithecho
Last active March 20, 2017 15:14
Show Gist options
  • Save elithecho/d06f20792e111bb8223cf9bbdf37e877 to your computer and use it in GitHub Desktop.
Save elithecho/d06f20792e111bb8223cf9bbdf37e877 to your computer and use it in GitHub Desktop.
Rails 5 setup files

Generating a new Rails 5 Project

rails new <appname> -T --d=postgresql
explaination

-T Skips test generator for those prefer using rspec

--d=postgresql generates with Postgresql as database

cd to directory and run command

if using rbenv or the like, run

you may use which ruby version you like

*note that rails 5 requires ruby version 2.2.2+

echo '2.4.0' > .ruby_version

Rails 5 uses secret so you can store your secret in a file and distribute it.

$ rails secrets:setup

# this command to edit your secrets
$ rails secrets:edit

Todo

  • Add spec/*_helper.rb file

After installing the gems

Generate DB
rails db:create
Run the necessessary generator for your gems
rails generate simple_form:install
rails generate simple_form:install --bootstrap
rails generate rspec:install

development.rb

  # use letter opener in development
  config.action_mailer.delivery_method = :letter_opener
@import "bootstrap-sprockets";
@import "bootstrap";
# Pick & Mix
# these are some of the pretty fundamental/recommended gems to use
# Gems are categorized into different use
# default rails gems will be left out to user's discrection
# Important gems, consider them almost required ===================================================
gem "slim-rails"
gem 'simple_form'
group :development, :test do
gem 'dotenv-rails'
gem 'pry-rails'
gem 'binding_of_caller'
gem 'better_errors'
gem 'rspec-rails', '~> 3.5'
end
group :development do
gem 'letter_opener'
end
# for heroku users
group :production do
gem 'rails_12factor'
end
#=====================================================================================
# Front-end
gem 'flutie'
gem 'bootstrap-sass', '~> 3.3.6' # if using bootstrap
# Misc
gem 'kaminari'
# OR
gem 'will_paginate', '~> 3.1.0'
# Authentication
gem 'devise'
gem 'sorcery'
# Image upload
gem 'dragonfly', '~> 1.1.1'
gem 'dragonfly-s3_data_store'
gem "rmagick", "~> 2.15", require: false
gem "mini_magick"
# Postgres
gem "jsonb_accessor", "1.0.0.beta.2"
# Api
gem 'active_model_serializers', '~> 0.10.0'
gem 'rack-cache', require: 'rack/cache'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment