Even though the default database SQLite3 works great with Ruby on Rails, we shouldn't be using it in some cases. For instance, if your Rails applicati

How To Use PostgreSQL With Ruby On Rails Application

submited by
Style Pass
2021-05-20 14:52:41

Even though the default database SQLite3 works great with Ruby on Rails, we shouldn't be using it in some cases. For instance, if your Rails application is being concurrently accessed by large number of users, SQLite is not recommended. We should try more robust databases like MySQL or PostgreSQL, which provides scalability, concurrency, centralization, and control. We already knew how to use MySQL with Rails application. Today, we will see how to use PostgreSQL with Ruby on Rails application in Ubuntu Linux.

This command will install PostgreSQL along with all required dependencies. Here, the libpq-dev is a PostgreSQL library that allows the client programs to pass queries to the PostgreSQL backend server and to receive the results of these queries. This library is required to connect to PostgreSQL when you setup a Rails application.

This will create a Rails application called ostechnixapp in a directory named ostechnixapp and install the gem dependencies that are already mentioned in Gemfile using bundle install.

Leave a Comment