Managing warnings emitted by Ruby 2.7

Ruby 2.7 is released on Christmas 2019.If you don't know what Ruby 2.7 offers, I have you covered.I tried running codetriage on Ruby 2.7. When I run rails c it prints tons of warnings about various deprecations./Users/prathamesh/.rbenv/versions/2.7.0-rc2/lib/…

Cross domain session sharing in Rails - Part 2

We have multiple micro services at Memory.ai which talk to each other and share data. As we are extracting more and more micro services, we were facing the problem of adding authentication layer in every service. In an ideal world, only one service would perform the authentication and other…

Cross domain session sharing in Rails - Part 1

We have multiple micro services at Memory.ai which talk to each other and share data. As we are extracting more and more micro services, we were facing the problem of adding authentication layer in every service. In an ideal world, only one service would perform the authentication and other…

prepend_before_action in Rails

Rails encourages usage of callbacks in controllers to execute common pieces of ┬ácode before or after an action. A very simple example of this is calling the authenticate_user! method from Devise before every action to make sure that user is authenticated.class ApplicationController < ActionController::Base before_action :authenticate_…

Mastering Packs in Webpacker

In the previous article, we saw what Webpacker is and how Rails 6 has integrated it. In this article, we will understand how to use the packs.A new Rails 6 app creates following files under app/javascript, the new destination for writing our JavaScript code.Projects/scratch/better_hn…

Making friends with RuboCop

At Memory.ai, we started using RuboCop heavily. This is a story of how we integrated RuboCop into our existing app. This is not an introductory post to RuboCop. Check out what RuboCop is before diving into our experience report.We started with rubocop, rubocop-performance, rubocop-rails and rubocop-rspec gems. We…

DNS rebinding attacks protection in Rails 6

It is common practice to run a Rails app using a custom domain locally. app.lvh.me is very common. We also use ngrok.io sometimes to interact with third party services. If you are using a custom domain on a Rails 6 app, you will see an error with…

Understanding Webpacker in Rails 6

Starting with Rails 6, Webpacker is the default JavaScript compiler. It means that all the JavaScript code will be handled by Webpacker instead of the old assets pipeline aka Sprockets. Webpacker is different from asset pipeline in terms of philosophy as well as implementation. In this blog post, we will…