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
Rails try hash key access Rails ActiveSupport provides try method on an object. Try is used to call a method on an object if it is not nil, otherwise return nil. Try method also be used on a
Rails + React JS application with CRUD operation Setting up Rails application with ReactJS usually takes some time. Setting up React Router and Redux for Front-end is an essential part of using React with Ruby on Rails.
Rails Routes expanded view option Listing rails routes and interpreting is quite troublesome if you are using a small screen on terminal. Rails 6 adds support to show rails routes in an expanded format with --expanded option.
Rails find_in_batches vs find_each Often, we come across querying in batches to fetch records through ActiveRecord in Rails. This article discusses how we can use find_in_batches and find_each to query records in batches with ActiveRecord.