/demo-rails-template

Rails demo testing template engines: ERB, HAML, SLIM

Primary LanguageRuby

Demo Ruby on Rails Template Engines

Goal

Try these three template engines used by RoR:

Using a slightly modified Rails Guide example.

Running the demo

This demo uses:

  • Ruby v 2.7.6
  • Ruby on Rails v 6.1.6.1
  • Postgresql v 14.2

All running inside docker containers. So it is required to have Docker and docker-compose with engine v 20.10.12

Edit the file .env-template: add a set of random characters for SECRET-TOKEN and save the file with the name .env

The commands displayed here work under any Linux distro.

Building the image and containers

To build the project(get docker images and prepare the container) This is done once after cloning the repo:

docker-compose build

To run the container:

docker-compose up

To stop the execution, use ctrl + c.

To set the database:

docker-compose run web rake db:create

After stopping the execution, use the following to stop the container:

docker-compose down

To check the working containers, use:

docker-compose images

Another option to check containers with VS Code is the Docker Addon

IMPORTANT

If Postgres is installed and already running in your system, it is required to stop the service as the Postgres docker image uses the same port.

sudo systemctl stop postgres.service

Sources for Docker procedure