Fetch records in a custom order with ActiveRecord in Rails Sometimes, you may want to fetch records in some arbitrary order of values of a column. This tutorial illustrates how to do fetch records based on some arbitrary order of values in a
How does rails decide if migrations are pending? Ever wondered how rails decides if any migration is pending? If not, this tutorial will explain how it is done using a table named schema_migrations.
Setup Rspec parallel tests with Circle CI While working on Rspec tests on a Ruby on Rails project, I realised the test suite is taking a lot of time. This was causing the pipelines run slow and resulting in slower
How to test a Ruby module? Ruby module can be used to group methods and constants together. This tutorial illustrates testing of ruby module either in isolation or based on the class where it is included or extended.
Ruby reduce method usage example Reduce method can be used to reduce a set of values to a single number / variable by performing some operation on an individual element. If unaware, you may end up using iterations
Rails first_or_create vs find_or_create_by on ActiveRecord Rails ActiveRecord provides methods like first_or_create, find_or_create_by methods to insert data based on certain conditions or create new records. We need to understand difference between first_or_create and find_or_create_by to use them as per