Getting Started with Ruby on Rails in 2024 - The Complete Development Environment Guide

Getting Started with Ruby on Rails in 2024 - The Complete Development Environment Guide

PagerTree Ruby on Rails Setup Guide: https://pagertree.com/blog/getting-started-with-ruby-on-rails-in-2024-the-complete-development-environment-guide

Overview

Ruby on Rails is a web development framework written in Ruby that helps developers build websites and applications quickly. It uses an MVC (Model-View-Controller) structure to organize code and make everyday tasks easier by following simple patterns instead of complex configurations. Rails also helps with database management and includes security features to protect against common threats. It's famous for building websites and apps, especially for startups, and powers well-known platforms like GitHub and Shopify.

This video will walk you through the 10 steps to setting up your Ruby on Rails development environment.

Step 1: Enable WSL

Enabling WSL will allow us to install and run Ubuntu. Ubuntu is a Linux distribution that is considered one of the easiest to use and has a lot of documentation, making it a good choice for setting up a Ruby on Rails development environment. Most of the code written with Ruby on Rails will run on a Linux server, so using Ubuntu can help ensure the development environment matches the production server.

Step 2: Install Ubuntu

Downloading Ubuntu from the Microsoft Store is a convenient way to run Ubuntu on your Windows machine without the need for dual-booting or using virtual machines. It runs through the Windows Subsystem for Linux (WSL), which allows you to use a complete Ubuntu terminal environment inside Windows.

Step 3: Update the Package List and Dependencies for Ruby

To get started with your Ruby install, we will install all the required dependencies for compiling Ruby within a Linux system. We will update the software packages using the Advanced Packaging Tool (APT) that are already in our terminal.

Step 4: Install the asdf Version Manager

Asdf is a Runtime Version Manager that manages multiple runtime versions within a single tool. We utilize asdf for Ruby on Rails to manage both Ruby and Node.js versions.

Step 5: Install Ruby

Ruby is the programming language used to build the framework. It’s known for being easy to read and write, which helps developers work quickly and efficiently. Ruby’s flexibility and simple syntax make it an excellent choice for web development, allowing you to build robust applications with less code. Rails uses Ruby to make web development faster and more intuitive.

Step 6: Install Node.js

Node.js is needed in a Ruby on Rails environment to handle front-end JavaScript tasks. While Ruby on Rails manages the backend, Node.js is commonly used to process and bundle JavaScript assets (like React, Vue.js, or Angular components), manage package dependencies with npm (Node Package Manager), and run tools like Webpack or Babel to optimize front-end code.

Step 7: Configure Git

Git is a standard tool in the software development industry for version control. We will set up our Ruby on Rails development environment to utilize Git as our version control.

Step 8: Install Rails

Rails is a web application development framework written in Ruby. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started.

Step 9: Install PostgreSQL

PostgreSQL is a powerful, open-source database system that stores and manages data for applications. It's known for being reliable, secure, and supporting complex queries, making it a popular choice for web apps, analytics, and more. We will be setting up our Ruby on Rails Development Environment to utilize PostgreSQL.

Optional Step: Install Redis

Redis is an open-source, in-memory data store used as a database, cache, and message broker. It is super fast and commonly used to store frequently accessed data, improving the performance of web applications by reducing the need to fetch data from a slower database. You can use Redis for caching in Rails or using Sidekiq background workers.

Step 10: Get Your Rails App Running

Your Ruby on Rails development environment is almost complete. The last steps are to create your app, create your database, and get coding.