How To Install ruby-discriminator on Ubuntu 20.04

In this tutorial we learn how to install ruby-discriminator on Ubuntu 20.04. ruby-discriminator is Gem making smart ActiveRecords by loading subclasses

Introduction

In this tutorial we learn how to install ruby-discriminator on Ubuntu 20.04.

What is ruby-discriminator

ruby-discriminator is:

Discriminator is a gem which makes ActiveRecord smart about loading subclasses from the database.

Ideally, we’d like to load up these Active Records from the databases, with their subclasses already applied with discriminator, otherwise it’s become cumbersome to determine each type in the database.

This can be exceptionally helpful for a single table inheritance situation, or something like events where there may be a large number of subclasses which could have very different behavior per subclass. Ruby-Versions: all

There are three methods to install ruby-discriminator on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install ruby-discriminator Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install ruby-discriminator using apt-get by running the following command:

sudo apt-get -y install ruby-discriminator

Install ruby-discriminator Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install ruby-discriminator using apt by running the following command:

sudo apt -y install ruby-discriminator

Install ruby-discriminator Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install ruby-discriminator using aptitude by running the following command:

sudo aptitude -y install ruby-discriminator

How To Uninstall ruby-discriminator on Ubuntu 20.04

To uninstall only the ruby-discriminator package we can use the following command:

sudo apt-get remove ruby-discriminator

Uninstall ruby-discriminator And Its Dependencies

To uninstall ruby-discriminator and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove ruby-discriminator

Remove ruby-discriminator Configurations and Data

To remove ruby-discriminator configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge ruby-discriminator

Remove ruby-discriminator configuration, data, and all of its dependencies

We can use the following command to remove ruby-discriminator configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge ruby-discriminator

References

Summary

In this tutorial we learn how to install ruby-discriminator package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.