Categories

Rails

What is Transaction? How to do it in Rails?

What is transaction?

In Rails, Database, Oct 29, 2023

Polymorphic Associations in Rails

.What is the usecase?Suppose two models can be associated to a third model with a common attribute. For example, Image can belong to User as well as Product, because user will have se...

In Ruby, Rails, Activerecord, Jun 19, 2023

Multiple Inheritance in Ruby

In this post we will learn about multiple inheritance in ruby.

In Ruby, Rails, May 09, 2023

Resolve early termination of worker in Rails

In this post we will resolve the error - Early termination of puma worker.

In Rails, Puma, Postgres, Dec 12, 2022

Allow HTTPS traffic via AWS Load balancer and EC2

In this post we will achieve passing only https traffic to EC2 via application load balancer.

In Rails, AWS, ELB, EC2, Apr 07, 2021

Rails 6.1 - adds defaults value to enum

How do we define enums? Pretty much like

In Rails, New addition, enum, Jul 04, 2020

Rails 6 - Managing API keys using 'credentials'

How do you manage application secret keys? We cannot commit them in Version Control System (like github), it is too dangerous.

In Rails, API keys, Secrets, Jul 04, 2020

Setting up Rails Performance dashboard with influxdb and grafana

When application gets stable at some point, we try to improve things we built for a while now. And improving performancetops the list for me. Application performance is a large concep...

In Rails, influxdb, grafana, APM, May 02, 2020

Reset primary key sequence

Resetting primary key sequence in Rails can be achieved by simply calling method reset_pk_sequence! on ActiveRecord with table_name.

In Rails, Postgres, Database, Apr 16, 2020

Sending Email from Rails

Sending email is integral part of every web application nowadays. In this post we will cover how to send emailsfrom a rails application.

In Rails, Email, Mar 06, 2020

Ruby date formatting

Ruby provides two classes to format date string strftime and strptime.

In Rails, Ruby, Jan 01, 2020

json and jsonb - Postgresql

Postgresql provides a data-type jsonb to save data from JSON format. There are two ways for it - using jsonand jsonb. This article will clarify difference in short terms.

In Rails, Postgres, Database, Dec 10, 2019

Sidekiq By Example : Ruby's background worker

What is the best way of handling background jobs in Rails, (maybe) using sidekiq.

In Rails, Sidekiq, Nov 28, 2019

Run seed data only on first Docker instance up

Q: Do we need to run rails db:seed, rails db:migrate every time the deployment happen? Ans - Absolutely no. rails db:seed should only run for the first time i.e. first deployment. But...

In Rails, Nov 22, 2019

HTTP request response headers

At the end browser talks in the language of HTTP request. But we really know minimal about it.

In Rails, Http, Aug 20, 2019

Ruby Ranges Overview

Range in ruby can be used in following situations

In Rails, Ruby, Aug 15, 2019

Useful Rails commands

rails dbconsole

In Rails, Command line, Aug 05, 2019

Rails 6 adds *_previously_was attributes method

Rails had previous_changes method to track value of object before and after save.

In Rails, new release, Aug 02, 2019

Scopes in Rails

Recently I was calling create method on an active-record model object. But it failed in validation, because the provided foreign_key_id was not present in the associated table.

In Rails, Scopes, Jul 11, 2019

String Comparison: StringInquirer

Generally we use ==/===/eql?/equal? for string comparison in Rails.It does work in all scenarios we needed. But we often tend to look how same things can be done in more clean ways or...

In Rails, Ruby, Jul 07, 2019

Squasher: Replacing old migrations

Too many migrations in application makes it painful. Sometimes they are written a long time back, that now you do not even remember. At the point you might want to replace them with s...

In Rails, Migrations, Jun 28, 2019

Modify a gem and use it in Rails

Sometimes a situation arises where we need to modify a gem according to our requirement and then successfully integrate into our project. Let’s find out!

In Rails, Gem, Jun 28, 2019

Rails Request Lifecycle...

Have you ever wondered how a request is processed in its lifecycle? What happens with request at each stage? Who handles request at what level? Let’s dig it out!

In Rails, Jun 12, 2019

How Indexes on database works!

When it comes to performance of an application, databases are highly important and effective. And one of the key factor in database optimisation is index. It helps in getting results ...

In Rails, Database, Jun 08, 2018

APIs in Rails 5.0 - overview

Have you ever wonder how APIs work in the world of convention over configuration, specifically in Rails 5.0?

In Rails, Api, Mar 23, 2018

Rails Includes vs Joins

When I started learning Rails, I was always in a state of confusion about using includes or joins,because both are used in almost same scenario. Includes uses eager loading whereas jo...

In Rails, Query, Mar 08, 2018

Why Rails? Why Ruby?

Ruby on Rails has been a prominent framework for web applications for last couple of years. But what has made it so worthy?

In Rails, Feb 28, 2018

Query

Rails Includes vs Joins

When I started learning Rails, I was always in a state of confusion about using includes or joins,because both are used in almost same scenario. Includes uses eager loading whereas jo...

In Rails, Query, Mar 08, 2018

Api

APIs in Rails 5.0 - overview

Have you ever wonder how APIs work in the world of convention over configuration, specifically in Rails 5.0?

In Rails, Api, Mar 23, 2018

Database

What is Transaction? How to do it in Rails?

What is transaction?

In Rails, Database, Oct 29, 2023

Reset primary key sequence

Resetting primary key sequence in Rails can be achieved by simply calling method reset_pk_sequence! on ActiveRecord with table_name.

In Rails, Postgres, Database, Apr 16, 2020

json and jsonb - Postgresql

Postgresql provides a data-type jsonb to save data from JSON format. There are two ways for it - using jsonand jsonb. This article will clarify difference in short terms.

In Rails, Postgres, Database, Dec 10, 2019

How Indexes on database works!

When it comes to performance of an application, databases are highly important and effective. And one of the key factor in database optimisation is index. It helps in getting results ...

In Rails, Database, Jun 08, 2018

Gem

Modify a gem and use it in Rails

Sometimes a situation arises where we need to modify a gem according to our requirement and then successfully integrate into our project. Let’s find out!

In Rails, Gem, Jun 28, 2019

Migrations

Squasher: Replacing old migrations

Too many migrations in application makes it painful. Sometimes they are written a long time back, that now you do not even remember. At the point you might want to replace them with s...

In Rails, Migrations, Jun 28, 2019

Ruby

What is self in Ruby?

self is a keyword in ruby which means it is reserved by Ruby to serve a specific purpose and we cannot use it like regular variables (although you can override it, but you shouldn’t).

In Ruby, Sep 08, 2023

Keywords in Ruby

Keywords are special words in Ruby which are reserved by the language and have predefined uses. Each keyword serves a different implementation than other. Let’s dive into these keywor...

In Ruby, Sep 04, 2023

Polymorphic Associations in Rails

.What is the usecase?Suppose two models can be associated to a third model with a common attribute. For example, Image can belong to User as well as Product, because user will have se...

In Ruby, Rails, Activerecord, Jun 19, 2023

Multiple Inheritance in Ruby

In this post we will learn about multiple inheritance in ruby.

In Ruby, Rails, May 09, 2023

Ruby date formatting

Ruby provides two classes to format date string strftime and strptime.

In Rails, Ruby, Jan 01, 2020

Ruby Ranges Overview

Range in ruby can be used in following situations

In Rails, Ruby, Aug 15, 2019

String Comparison: StringInquirer

Generally we use ==/===/eql?/equal? for string comparison in Rails.It does work in all scenarios we needed. But we often tend to look how same things can be done in more clean ways or...

In Rails, Ruby, Jul 07, 2019

Scopes

Scopes in Rails

Recently I was calling create method on an active-record model object. But it failed in validation, because the provided foreign_key_id was not present in the associated table.

In Rails, Scopes, Jul 11, 2019

new release

Rails 6 adds *_previously_was attributes method

Rails had previous_changes method to track value of object before and after save.

In Rails, new release, Aug 02, 2019

Command line

Useful Rails commands

rails dbconsole

In Rails, Command line, Aug 05, 2019

Http

HTTP request response headers

At the end browser talks in the language of HTTP request. But we really know minimal about it.

In Rails, Http, Aug 20, 2019

Sidekiq

Sidekiq By Example : Ruby's background worker

What is the best way of handling background jobs in Rails, (maybe) using sidekiq.

In Rails, Sidekiq, Nov 28, 2019

Postgres

What is libpq?

You might have heard about libpq while installing/operating postgresql. But what is libpq? Let’s understand.

In Postgres, Jul 03, 2023

Resolve early termination of worker in Rails

In this post we will resolve the error - Early termination of puma worker.

In Rails, Puma, Postgres, Dec 12, 2022

Reset primary key sequence

Resetting primary key sequence in Rails can be achieved by simply calling method reset_pk_sequence! on ActiveRecord with table_name.

In Rails, Postgres, Database, Apr 16, 2020

json and jsonb - Postgresql

Postgresql provides a data-type jsonb to save data from JSON format. There are two ways for it - using jsonand jsonb. This article will clarify difference in short terms.

In Rails, Postgres, Database, Dec 10, 2019

Email

Sending Email from Rails

Sending email is integral part of every web application nowadays. In this post we will cover how to send emailsfrom a rails application.

In Rails, Email, Mar 06, 2020

influxdb

Setting up Rails Performance dashboard with influxdb and grafana

When application gets stable at some point, we try to improve things we built for a while now. And improving performancetops the list for me. Application performance is a large concep...

In Rails, influxdb, grafana, APM, May 02, 2020

grafana

Setting up Rails Performance dashboard with influxdb and grafana

When application gets stable at some point, we try to improve things we built for a while now. And improving performancetops the list for me. Application performance is a large concep...

In Rails, influxdb, grafana, APM, May 02, 2020

APM

Setting up Rails Performance dashboard with influxdb and grafana

When application gets stable at some point, we try to improve things we built for a while now. And improving performancetops the list for me. Application performance is a large concep...

In Rails, influxdb, grafana, APM, May 02, 2020

API keys

Rails 6 - Managing API keys using 'credentials'

How do you manage application secret keys? We cannot commit them in Version Control System (like github), it is too dangerous.

In Rails, API keys, Secrets, Jul 04, 2020

Secrets

Rails 6 - Managing API keys using 'credentials'

How do you manage application secret keys? We cannot commit them in Version Control System (like github), it is too dangerous.

In Rails, API keys, Secrets, Jul 04, 2020

New addition

Rails 6.1 - adds defaults value to enum

How do we define enums? Pretty much like

In Rails, New addition, enum, Jul 04, 2020

enum

Rails 6.1 - adds defaults value to enum

How do we define enums? Pretty much like

In Rails, New addition, enum, Jul 04, 2020

AWS

Allow HTTPS traffic via AWS Load balancer and EC2

In this post we will achieve passing only https traffic to EC2 via application load balancer.

In Rails, AWS, ELB, EC2, Apr 07, 2021

ELB

Allow HTTPS traffic via AWS Load balancer and EC2

In this post we will achieve passing only https traffic to EC2 via application load balancer.

In Rails, AWS, ELB, EC2, Apr 07, 2021

EC2

Allow HTTPS traffic via AWS Load balancer and EC2

In this post we will achieve passing only https traffic to EC2 via application load balancer.

In Rails, AWS, ELB, EC2, Apr 07, 2021

Puma

Resolve early termination of worker in Rails

In this post we will resolve the error - Early termination of puma worker.

In Rails, Puma, Postgres, Dec 12, 2022

Activerecord

Polymorphic Associations in Rails

.What is the usecase?Suppose two models can be associated to a third model with a common attribute. For example, Image can belong to User as well as Product, because user will have se...

In Ruby, Rails, Activerecord, Jun 19, 2023