Prem SichanugristIgnore Git revisions in git blameGitHub recently added support for ignoring revisions in git blame, which should be useful for when you have commits that change code style.Jul 22, 2022Jul 22, 2022
Prem SichanugristConfirm current database connection in Rails consoleUseful when you want to avoid running a big query on your main writer database.Feb 4, 2022Feb 4, 2022
Prem SichanugristWriting a pass-through method, Ruby 2.7 editionYou may have written a Ruby method which pass all the arguments to the underlying method, and Ruby 2.7 just introduced a new syntax for it.Mar 26, 2020Mar 26, 2020
Prem Sichanugristfetch vs. [] || for default value in RubyTL;DR: Use Hash#fetchMar 23, 2019Mar 23, 2019
Prem SichanugristMissing translations keys — Gotta Catch ’Em All`config.action_view.raise_on_missing_translations = true` actually does not apply to direct `I18n.t` calls. Here’s how to make it do so.Oct 23, 2018Oct 23, 2018
Prem SichanugristThink twice before using double splat in RubyAs of Ruby 2.5.1, double splat operator (**options, for example) is still considerably slower than accepting a normal argument and sets a…Jul 4, 20181Jul 4, 20181
Prem SichanugristA new helper to freeze time in Rails 5.2This one is a simple quality-of-life improvement.Jun 8, 2018Jun 8, 2018
Prem SichanugristExpanded rails routes in Rails 6.0In Rails 6.0, rails routes command will support --expanded (or -x, the shorthand version). This is similar to \x mode in psql where it will…Jun 7, 2018Jun 7, 2018
Prem SichanugristRelation.pick in Rails 6.0Back in 2012, Rails 3.2.0 added a .pluck method which you can call on a ActiveRecord::Relation or a model class:Jun 6, 2018Jun 6, 2018