Using String in Active Record(Rails) Enum

Rails model helps you define enum on a database integer field quite easily. The enum method which rails provide in its model is not an interface to the enum datatype available in some databases, but converting or using a integer field as an enum. Enum type or Enumerated type is user defined data type where you define the set of value the data type will have. If you consider regular or basic or primitive data types, they are pretty much like enum where the values it can hold is defined already by the language. Ruby dynamic type system does hide all this complexity for us while we develop.

Enum is quite useful when you want to make sure that only a specified list of values are saved for a field.

PHP + MySql a Deadly Combination: My introduction to the real world

I am currently a senior Ruby on Rails programmer. This article is my tribute to PHP the language that introduced me to the real world. I have been programming or aspiring to program (former/recovering imposter syndrome addict) since I was a child. You can say I was programming as well if you consider lego programming and hello world in turbo c as programming. During upper primary and high school I spend my time learning Java, C and C++.

GIN: Generalized Inverted iNdex (on text)

Indexes are an integral part of any production database. It improves the speed of your query, and which in tern speeds up your application. The faster you get your data, faster you can provide the result to your user, faster you can move on to your next user. Knowing different type of indexes allows you to choose which is the best for your data. As there is no silver bullet.

PostgreSQL is the DB refereed to in this article

This article is my humble attempt to explain and simplify what is Gin.

Count How Many Routes You Have

It start with one, then two and it keeps on growing. The number of routes in your ruby on rails project can be a reflection of how complex your project is becoming. And if you are curious like me to know how many routes your project has, just run the following command in your rails console.

Books I Read 2021

As a followup on my 2020 article on the list of books I have read in 2020. Here is 2021 version. I aimed to read at least one book a month in 2021. During some months I was able to achieve more than one book a month, but sadly I couldn’t keep it up for the whole year. 2022 is another year, hope to be able to do one book a month minimum this year.