Sometimes, we need to delete records logically but not physically. Paranoia gem allows us to soft delete records. Records are marked as deleted by a column in a table. Article helps understand how to soft delete Records in Rails with Paranoia gem.»
ActiveAdmin is one of the most used Admin interface with the Rails applications. It provides an easy way to view, create, update or destroy records. When a model is registered with ActiveAdmin, it may have associations. In that case, when index page is opened for the model, it fires N+1 queries to fetch the values of an associated class. This presents performance bottleneck. This article will help remove N+1 querying on ActiveAdmin controller index action for a model.»
Rails 5.1 added
form_with form helper method
that provides capabilities of
form_tag that provide similar interfaces
to generate forms with
Ruby 2.3 has introduced safe navigation operator.
Safe navigation operator returns nil
if a method is called
if a method is called on a
it throws an error as given below.
In Rails, sometimes we need to iterate over all the records from a model.
To achieve this people prefer to use
all.each on a model.
This can lead to usage of memory if there are millions (huge number of) records in the table.
I was working on a problem to check on a large array of integers to check whether it is a part of another array or not. Both the arrays have unique elements, but not in sorted order. So there are multiple ways possible to this, but I was not sure that which approach is most efficient. I searched for this but couldn’t come across anything valuable. Then I decided to benchmark whole approach by my self.»
Today, I was looking at the internal working of a gem. While working on the same, I came across the code where the network calls were being made and it had to check if the response params has some set of keys.»
To setup HTTPs load balancer on Google Cloud Platform , we need to create an SSL certificate beforehand. Letsencrypt can be used to create an SSL certificate free of cost. The SSL certificate provided by Letsencrypt is valid for 3 months. In this article, we will learn how to setup HTTPs load balancing using Letsencrypt certificate for a Ruby on Rails application on Google Cloud Platform.»
In traditional programming practice, I/O operations happen synchronously. The main thread will be blocked until I/O operation gets completed and CPU remains idle for the time I/O operation is getting completed. Consider the following example where CPU is blocked until query execution completed.»
in creating User Authentication layer
for the Ruby on Rails applications.
The other day, I was taking a session on
to resolve a query from a Ruby on Rails developer.
The developer had added an enum attribute
role on the
The query was
how to update custom attribute added
to users table generated by devise gem.
DHH [Creator of Rails] has recently announced Active Storage as a built in support for file uploads. Active Storage is targeted to be released with Rails 5.2. The development has been started on Github in ActiveStorage repository. It is started as a separate repository for now. This ActiveStorage is eventually planned to be merged in Rails repository.»
Rails 5 has improved the way query was done on database when pluck was called on a model. Before Rails 5, when pluck was called, it used to query database even if the activerecord collection is queried before. There are some posts explaining don’t pluck unnecessarily In this post we will discuss how Rails 5 has improved the way pluck used to work.»
While working on integrating Google Map with the Rails 5 application, faced an error saying»
In Rails, exception_notification is popular gem used for Exception Notification to email. Slack is a new tool which is very popular among teams for collaboration. This article will help us understand the way to configure exception_notifier gem to send notifications to your Slack channel from Ruby on Rails application.»
Google has released Material UI. Since then, Material UI is getting a lot of attraction from Designers and Developers around the world. This article will help you create Material UI application in Rails.»