Rails Environment

Follow Setup Ruby On Rails on GoRails.

Create Rails Project

# create a project
$ rails new --skip-test-unit --database=postgresql playgound

# create database
$ cd playgound
$ bin/rake db:create db:migrate

Edit config/database.yml to make sure DB setup is correct.

Setup RSpec and Capybara

Follow RSpec Setup in Rails 4.

Setup Bootstrap

Use 42dev/bower-rails or add gems to Gemfile:

gem 'bootstrap-sass', '~> 3.2.0'
gem 'font-awesome-sass', '~> 4.1.0'
gem 'autoprefixer-rails'

Download bootstrap.scss to app/assets/stylesheets/bootstrap-custom.css

Rename app/assets/stylesheets/application.css to application.css.scss, replace all content with:

@import "bootstrap-sprockets";
@import "bootstrap-custom";
@import "font-awesome";

Add Bootstrap’s JavaScript modules to app/assets/javascript/application.js:

//= require bootstrap/affix
//= require bootstrap/alert
//= require bootstrap/button
//= require bootstrap/carousel
//= require bootstrap/collapse
//= require bootstrap/dropdown
//= require bootstrap/tab
//= require bootstrap/transition
//= require bootstrap/scrollspy
//= require bootstrap/modal
//= require bootstrap/tooltip
//= require bootstrap/popover

These enable you control which bootstrap module included.


Setup Devise and Pundit

Add gems to Gemfile:

# Use devise for Authentication
gem 'devise'
# Use pundit for Authorization
gem 'pundit'

Install Devise rails generate devise:install and follow the instructions.

Create a User model rails generate devise user and rake db:migrate.


Other useful Gems

# Loading environment variables
group :development, :test do
  gem 'dotenv-rails'
# Thread-safe Email validator
gem 'email_validator'
# Extra ActionView view helpers
gem 'flutie'
# Serve Static pages
gem 'high_voltage', '~> 2.2.1'



To stop auto-generation of helpers, javascripts and stylesheets, add the following to config/application.rb:

config.generators do |generate|
  generate.helper false
  generate.javascript_engine false
  generate.stylesheets false
  generate.request_specs false
  generate.routing_specs false
  generate.view_specs false


All these steps can be automated using Rails Application Templates.

TODO: Template required