07.06.2023

Installing Ruby on Rails 3.1.2 on Windows

A short note about the framework:

Ruby on Rails was written in the programming language "Ruby". It was created as far back as 2004, and gained its popularity through an interaction with Apple in 2006. At that time "Apple" announced that it will ship "Ruby on Rails" together with Mac OS X 10.5 "Leopard" operating system.

Also we must not forget that this framework has influenced the development of web applications through innovative features such as creation of database tables, migration and creation of presentation frameworks to ensure fast application development.

The uniqueness of Ruby

There are many web development frameworks in the programming world, but Django and Ruby on Rails stand out the most.

This makes them the most popular web development frameworks and this popularity will continue to grow.

Framework scalability

While Django inherited its scalability from Python, it is still slightly behind Rails. It has better scalability, which is a result of its qualities of freedom and code flexibility. Both are heavyweight web development frameworks, so they are both designed with scalability in mind, but in this case the win goes to Ruby on Rails.

Syntax

Ruby's syntax is known to be very flexible. However, this can not always be attributed to the advantages of Ruby on Rails. It can cause problems and make it difficult to pass a project to other team members, as the same function can be implemented in different ways, creating confusion.

Whereas Python advocates that there should only be one obvious way to do something, which makes the code easier to debug and read.

Installing the necessary packages:

To run Ruby on Rails on Windows 10, you need to install the following programs:

Let's move on to downloading and installing Nodejs.

Follow the link and download the LTS version.

After selecting the LTS version you will automatically start downloading the package, you need to install it by opening the executable file after downloading.

Required to select the automatic installation of the necessary tools.

After installation, restart your personal computer and go to the command line to check the installation.

Since we chose to install the necessary components, immediately after completion a script will open for installation.

You can check the installation by using the command :

node --version

Installing Yarn:

Follow the link, open the "Alternatives" tab and download the "classic stable 1.22.19" package.

Run the executable file and follow the installation steps.

After installation restart your PC and check the installation by running the command line and typing the command below:

yarn --version

Installing Sqlite:

Go to the link and download the two sqlite archives:

After downloading, unzip both archives to "C:\windows\system32"

You can check the functionality and version of sqlite using the command below:

sqlite3 --version

Installing Ruby:

Go to the link and download the latest version of Ruby with developer tools, currently "Ruby 3.1.2-1"

Install Ruby by opening the executable file. Also after installation is complete check the "run rdk install" option to install MSYS2 automatically.

The command line will automatically open with the offer to install MYSYS2, choose point 3.

Further installation is done automatically.

You can check Ruby version and availability using command below:

ruby --version

It's required to run the commands below, first opening a command line as admin:

gem install tzinfo-data
gem install sqlite3

gem install rails

Create a project and run Ruby on Rails:

Open a command prompt as an administrator. Navigate to the directory you want and type the command below:

rails new *project name*

After that, browse to your project directory and run your project with the command

rails server:

rails server

You can go to our server using your local address.

Note:

If you have a problem starting your project go to your project folder and open the Gem configuration file with any text editor you like. Fix the line as shown below:

Example error:

The line before the changes:

gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]

String after changes:

"gem tzinfo-data"

Use the commands below to check that all the packages you have installed are working:

Ruby --version
Sqlite3 --version
Node --version
Yarn --version
Gem --version
Rails --version

Conclusion:

Thanks to this publication you can easily install Ruby on Rails on Windows 10.