Rails application boilerplate using Bootstrap Layout.
You can see a working live demo of this boilerplate running on Heroku.
git clone https://github.com/themekit/bs-layout-boilerplate-rails.git my-project
cd my-project
npm install
This application boilerplate runs on Rails
2.3.1
. We recommend installing rvm (Ruby Version Manager) and then install ruby:
rvm --force install 2.3.1
rvm --default use 2.3.1
Install Bundler and Rails:
gem install bundle
gem install rails
Install the application dependencies:
bundle install
Start rails server on
http://localhost:3000
:
rails s
Precompiling assets:
RAILS_ENV=production bin/rake assets:precompile
Start rails server in production:
rails s -e production
The complete list of files modified or created in addition to the default Rails installation.
├── .env
├── Gemfile
├── Procfile
├── app
│ ├── assets
│ │ ├── javascripts
│ │ │ └── application.js
│ │ └── stylesheets
│ │ └── application.css.scss
│ ├── controllers
│ │ └── static_controller.rb
│ └── views
│ ├── layouts
│ │ ├── application.html.erb
│ │ └── fixed.html.erb
│ └── static
│ └── content.html.erb
├── config
│ ├── application.rb
│ ├── environments
│ │ ├── development.rb
│ │ └── production.rb
│ └── routes.rb
└── package.json
For the purpose of this application boilerplate, we intentionally disabled the database connection.
To use the default Rails database connection, uncomment the following from the
Gemfile
:
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
Install the gem:
bundle install
Uncomment the following in
config/application.rb
:
require "active_record/railtie"
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
Uncomment the following in
config/environments/development.rb
:
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
Uncomment the following in
config/environments/production.rb
:
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
First, get a free Heroku Account and download the Heroku Toolbelt. Then, login to Heroku:
heroku login
From the project root directory, create a Heroku app. Note that Heroku generates a random name for your app or you can pass parameter to specify your own app name.
heroku create
Configure the Heroku app to use the official Ruby buildpack:
heroku buildpacks:set heroku/ruby
Add the Node.js buildback at the first position, to ensure
npm install
runs first:
heroku buildpacks:add --index 1 heroku/nodejs
Configure the Heroku app to use the production mode:
heroku config:set RACK_ENV=production
Note that
sqlite3
will NOT work on Heroku. See details and alternatives on https://devcenter.heroku.com/articles/sqlite3
To run the Heroku app on
http://localhost:5000
, run:
heroku local
When you created the app with
heroku create
, a git remote (calledheroku
) was also created and associated with your local git repository. To publish the application, you simply have to push to that remote:
git push heroku master
Ensure at least one instance of the application is running:
heroku ps:scale web=1
Visit http://<APP NAME>.herokuapp.com
in your browser to see the Rails app running.
Get help directly from our team via our Slack channel. Request invite