Recent Posts

  • August 02, 2019

    Rails 6 adds *_previously_was attributes method

    Rails had previous_changes method to track value of object before and after save.

  • July 11, 2019

    Scopes in Rails

    Recently I was calling create method on an active-record model object. But it failed in validation, because the provided foreign_key_id was not present in the associated table.

  • July 07, 2019

    String Comparison: StringInquirer

    Generally we use ==/===/eql?/equal? for string comparison in Rails. It does work in all scenarios we needed. But we often tend to look how same things can be done in more clean ways or how other developers in Rails community would have done that.

  • June 28, 2019

    Squasher: Replacing old migrations

    Too many migrations in application makes it painful. Sometimes they are written a long time back, that now you do not even remember. At the point you might want to replace them with something simple and compact.

  • June 28, 2019

    Modify a gem and use it in Rails

    Sometimes a situation arises where we need to modify a gem according to our requirement and then successfully integrate into our project. Let’s find out!