New framework defaults in Rails 6

Rails 6 is released. This post is part of the Road to Rails 6 series which will prepare you for Rails 6.Every time a new major Rails version is released, there are tons of breaking changes. Upgrading existing app to the new version can be sure shot recipe for…

Advanced multi-db techniques in Rails 6

Rails 6 is just around the corner. The release candidate two was recently released. This post is part of the Road to Rails 6 series which will prepare you for Rails 6.Check the part one of this post where we saw how to setup an app with multiple databases…

How to (not) use unscoped in Rails

Active Record provides unscoped to remove all the scopes added to a model previously.class Article default_scope { where(published: true) } end Article.all # SELECT * FROM articles WHERE published = true Article.unscoped # SELECT * FROM articlesLet's say I want to fetch all articles of an author, published or otherwise.author = Author.…

Installing capybara-webkit gem on Ubuntu 16.04

I was not able to install capybara-webkit gem on Ubuntu 16.04. I tried to follow the instructions mentioned in the gem wiki to solve this problem.sudo apt-get update sudo apt-get install g++ qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-xThen it gave an error saying that the package…

Understanding how Ruby initializes objects

Deep buried in Rails source code, there is a code snippet:class DeprecationProxy def self.new(*args, &block) object = args.first return object unless object super end ... end It was added 9 years ago and the commit message said:Override new on proxy objects so that they never wrap…

Insights from the SICP meetup

We organized a SICP reading meetup on 11th May in Pune. Our inspiration was similar meetup from our friends Siddharth and Soham in Mumbai. This was the second such meetup that we did. The first one was organized in April.When we started this meetup, we didn’t know what…