If you are using Rails muti-database feature, it's quite useful to know if you…
This one is a simple quality-of-life improvement.
In 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 print the record in detailed list instead of in a table.
rails routes
--expanded
-x
\x
psql
$ rails routes --expanded--[ Route 1…
Back in 2012, Rails 3.2.0 added a .pluck method which you can call on a ActiveRecord::Relation or a model class:
.pluck
ActiveRecord::Relation
> User.pluck(:id)#=> [1, 2, 3]
But what if you need just the first value from the result? You will probably have to…