This is a general purpose Rails 5.0.1 app template that is setup to use postgresql. It includes authentication, authorization and bootstrap styling.
- Fork and/or clone this repo from github.
git clone git@github.com:pedrogrande/rails501template.git
. Apply your own project name by adding the app's name after this command. - Enter the created folder:
cd rails501template
. Or the name you gave your project. - If you don't have Postgresql installed locally, you may wish to swap the database to sqlite3. Change this in the Gemfile. This will also require you to update
config/database.yml
to reflect the sqlite3. - Run a bundle.
bundle
- Edit the database names in
config/database.yml
(only if using Postgresql) - Create the databases:
rails db:create
- Run the migrations:
rails db:migrate
- Optionally, seed the database with a default admin user:
rails db:seed
- devise
- simple Form
- cancancan
- rolify
- bootstrap (Bootstrap v4)
- font-awesome-sass
- rails_12factor in a production group (for Heroku).
A user model is added with default Devise settings.
A devise layout has been created in app/views/layouts
that puts the devise views in a centered bootstrap panel.
Simple_form is installed with the --bootstrap flag.
Browser validations config setting has been set to true in config/initializers/simple_form.rb:120
config.browser_validations = true
The ability model file has been edited to use Rolify has_role? method.
app/models/ability.rb
Version 4 of Bootstrap is installed through the bootstrap-sass gem.
A navbar partial is located in app/views/shared
.
A fading alerts partial is located in app/views/shared
.
The navbar has Rails code to show a Sign in link when the user is not signed in. When the user is signed in, they will see a Dropdown menu and Sign out link.