Intelligence, Inside and Outside.
Ruby

How To Get Started With A Ruby On Rails Project – A Developer’s Guide

In this guide you will be able to create a Ruby on Rails application for your development environment. These steps can also be used when deploying an application on a production environment for the setup of the required software. 

Installing the required software

Ubuntu

Execute the following steps and commands to install the required software. 

System update and required system libraries

sudo apt update
sudo apt upgrade -y

sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev

ASDF

Is a version management tool. Which can be used to manage softwares like Ruby and Node.

cd
git clone https://github.com/excid3/asdf.git ~/.asdf
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc
echo 'legacy_version_file = yes' >> ~/.asdfrc
echo 'export EDITOR="code --wait"' >> ~/.bashrc
exec $SHELL

Ruby

asdf plugin add ruby

asdf install ruby 3.3.0
asdf global ruby 3.3.0

# Update to the latest Rubygems version
gem update --system

Verify that ruby is installed by checking where it is located and the version installed. 

which ruby
#=> /home/username/.asdf/shims/ruby

ruby -v
#=> 3.3.0

NodeJS

asdf plugin add nodejs

asdf install nodejs 20.10.0
asdf global nodejs 20.10.0

# Install yarn for Rails jsbundling/cssbundling or webpacker
npm install -g yarn

Verify that Node has been installed by checking where it is located and the installed version.

which node
node -v

Rails

gem install rails -v 7.1.2

Check the version installed

rails -v

Mac

Open a terminal and run the following steps.

Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

ASDF

Is a version management tool. Which can be used to manage software like Ruby and Node.

cd
git clone https://github.com/excid3/asdf.git ~/.asdf
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.zshrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.zshrc
echo 'legacy_version_file = yes' >> ~/.asdfrc
exec $SHELL

Ruby 

asdf plugin add ruby

asdf install ruby 3.3.0
asdf global ruby 3.3.0

# Update to the latest Rubygems version
gem update --system

NodeJS

asdf plugin add nodejs

asdf install nodejs 20.10.0
asdf global nodejs 20.10.0

# Install yarn for Rails jsbundling/cssbundling or webpacker
npm install -g yarn

Verify that Node has been installed by checking where it is located and the installed version.

which node

node -v

Rails

gem install rails -v 7.1.2

Check the version installed

rails -v

Windows

To run the necessary software, they can be run by installing a Linux subsystem in the Windows environment.

Read More  Success With Machine Learning Projects In Python

On a power shell run the following commands.

01: Create a new project using the rails command

wsl --install -d Ubuntu

02:  Reboot the computer after the installation.

03: Follow the instructions from the Ubuntu steps.

System update and required system libraries

sudo apt update

sudo apt upgrade -y

sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev

ASDF

Is a version management tool. Which can be used to manage softwares like Ruby and Node.

cd
git clone https://github.com/excid3/asdf.git ~/.asdf
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc
echo 'legacy_version_file = yes' >> ~/.asdfrc
echo 'export EDITOR="code --wait"' >> ~/.bashrc
exec $SHELL

Ruby 

Note: This process takes some time to be completed.

asdf plugin add ruby
asdf install ruby 3.3.0
asdf global ruby 3.3.0

# Update to the latest Rubygems version
gem update --system

Verify that ruby is installed by checking where it is located and the version installed. 

which ruby#=> /home/username/.asdf/shims/ruby
ruby -v#=> 3.3.0

NodeJS

asdf plugin add nodejs

asdf install nodejs 20.10.0
asdf global nodejs 20.10.0

# Install yarn for Rails jsbundling/cssbundling or webpacker
npm install -g yarn

Verify that Node has been installed by checking where it is located and the installed version.

which node

node -v

Rails

gem install rails -v 7.1.2

Check the version installed

rails -v

Starting a new project

01. Create a new project using the rails command

rails new my-rails-project

02. Navigate to the new project

cd my-rails-project

03. Create the database. Note that since we did not specify what database during the creation of the project, this defaults to SQLite.

rails db:create

04. Run the rails server

rails server

05. Open the following URL on a browser.

http://127.0.0.1:/3000

or via cURL inside a terminal

curl http://127.0.0.1:/3000
Ruby on Rails 7.1.3

For enquiries, product placements, sponsorships, and collaborations, connect with us at [email protected]. We'd love to hear from you!
Share this article
Shareable URL
Prev Post

How To Get Started With Klaviyo – A Developer’s Guide

Next Post

How AI In Healthcare Could Bridge A Significant Capacity Gap

Read next