© 2022 Hashnode
What are they? ActiveRecord callback is a tricky Rails-way method to trigger some code in different phases of persisting model object. Example: class Order < ApplicationRecord before_save :set_total after_commit :send_order_confirmation…
The first script ensures your Sidekiq instances would act properly on each application deployment: commands: create_post_dir: command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post" ignoreErrors: true files: "/opt/elastic…
Imagine that you develop an e-commerce platform. Your basic model is Order. You would have some constraints which don't have to be valid before order is placed: validates :order_items, length: {minimum: 1}, unless: :cart? validates_presence…
&., called “safe navigation operator”, allows to skip method call when receiver is nil. It returns nil and doesn't evaluate method's arguments if the call is skipped. The operator first appeared in Ru…
Hello, I use code snippets rather than long English paragraphs to explicate the working. Let's take a look at Ruby's try method:
dig and fetch are two powerful methods for manipulating a Hash object in Ruby. dig Pass the comma separated keys in the order of the nesting to dig the hash and obtain the value. fetch This method f…
Author's Note: This post is related to the Rails Fitness application that I started earlier this summer. I wrote a multi-post series about building this app and you can read the prelude to Part 1 h…
We've explored building a conference line with Ruby on Rails before, but the result there was a conference call that anyone could join. If you want to keep your calls a little more private you will wa…
My son recently celebrated his 9th birthday, and like many kids his age, he was looking forward to his birthday party for months. In the midst of the Covid-19 pandemic, we knew that we needed to do so…
When you need to get a bunch of remote people to talk together, a conference call is the simplest way to do so. Everyone dials a number and in seconds they are talking to each other. In this post we'l…