Michael Anhari

Hello πŸ‘‹πŸ»

I'm Michael.

product-minded software consultant

Recent Articles

Getting to know your Rails dbconsole (PostgreSQL)

Let's go over a few commands that are helpful when poking around in the Postgres console
databasespostgreSqlrails

Goodbye webpack?

A few backend frameworks are looking to replace webpack with something less heavy-handed, Rails included.
elixirjavaScriptphoenixrailsruby

Adding counter caches to existing models in Rails

Counting the amount of records that exist is a very common task for your database. Rails has a built-in mechanism for caching this value to reduce the number of round trips.
databasespostgreSqlrailsruby

Ensuring a column is unique for an entity in Rails

Sometimes you want to validate that a column is a unique for a given relationship and not across the entire table.
databasespostgreSqlrails

How to use acronyms in the classes of your Rails application

Acronyms are strange to implement in Ruby, but are easy to manage in Rails when leveraging ActiveSupport.
railsruby

Using namespaces to organize your Rails code base

Sometimes you want to namespace areas of your application to group related code together, and Rails has support for this baked in.
architecturerailsruby

Grabbing the last result in common Rails debuggers

Sometimes you want to access the value returned by the last command you wrote into a Ruby REPL. There’s a trick for that.
ruby

Using i18n to customize submit button text in Rails

The Rails submit form helper populates the button's text by using a humanized/readable version of the model's class name. Sometimes that isn't idea, but i18n has our backs.
i18nrails

Why I no longer define ActiveRecord scopes with class methods

ActiveRecord scopes can be defined using the scope method or class methods on your model using the self keyword, but there is an important difference between the two.
rails

Using dbconsole to index and test Rails query performance on the fly

Rails ships with a command for loading up the REPL for your database that can be useful for testing out the effectiveness of adding indexes to lower query response times.
databasesperformancepostgreSqlrails
Archives

Newsletter

I'm working on sending out a weekly newsletter. I'll make it as easy as possible to unsubscribe at any time.