Rails add_reference vs add_column in migrations Rails supports schema statements like add_reference and add_columns. They have different options and serve different purpose as illustrated in this post.
Ruby console [IRB] disable echo output Ruby console [IRB] echoes the output of last line executed. Sometimes, when data to output is huge, it is quite troublesome. To disable echo in IRB, we need set a echo flag on
Rails Webpack public packs clean up assets When using webpacker with Rails, webpack assets from public/packs folder usually occupy a lot of disk space. Thus, it is important to clean up disk space time to time or we can use
Ruby catch exceptions with StandardError and not Exception When catching exceptions in Ruby, people often tend to use Exception class. This is often not the intended class. It’s important to understand when to use StandardError, RuntimeError or any other exception class
Rails Rails routes difference between resource and resources Rails provides RESTful routing for resources. Routes can either define single resource or plural resources to generate routes of the application.
Rails How to get integer value from enum in Rails? Getting value of integer stored in database for enum attribute on Rails ActiveRecord models can get tedious. This article will help understand how to fetch integer value of enum on ActiveRecord model in