Latest Posts
Personal blog by Karina Baha.
-
Add and Change Default Column Value in Ruby on Rails
In Ruby on Rails, it’s easy to set and change a default value for columns in your application database. Say we have an online shop, and we want to set a default price for our products. How can we do that? And if we want to change the default price later, how do we do…
-
Ruby on Rails 7 Credentials
Ruby on Rails stores the encrypted credentials of your application in the credentials.yml.enc file in the config/ folder. Rails encrypts them using the master key in the config/ folder or the ENV[‘RAILS_MASTER_KEY’] if you provide one.
-
Change PostgreSQL User Password in Ubuntu
In this post, we will discuss how to change a PostgreSQL password in the Ubuntu operating system using the psql front-end.
-
Ruby on Rails has_secure_password Tutorial
The has_secure_password method adds methods to encrypt a password using the bcrypt algorithm. Also, it adds methods to authenticate against such a bcrypt password. For this method to work, the user model must have a password_digest attribute. In this tutorial, we’ll build a simple application with a user model, and we will discuss in detail…
-
Restore a Dump File Using pgAdmin
In this post, I will show you how to restore a dump file using pgAdmin 4.
-
MVC Pattern in Ruby on Rails
In this article, we will talk about how Ruby on Rails implements the MVC pattern. MVC (Model, View, Controller) was first described and implemented into the Smalltalk-79 user interface paradigm by Trygve Reenskaug. Its purpose was to allow the user to access and edit complex data in an accessible manner.
-
Select Records Created within the Last X Months in Ruby on Rails
Suppose we have a blog application, and we want to show on the index page only the latest posts. Say we want to show the posts created within the last three months. How can we do that? We can use the Active Record query interface. We can use range conditions.
-
The Root Route in Ruby on Rails
When developing a web application, the most important thing is to set what to display on the home page. In Ruby on Rails, we specify what we want to show on the home page by defining a root route.