1. Have you lost a second of data?

    Based on some good Reddit discussions I've revised the "Only use ranges." section to use a range with an exclusive end.

    One of the gems I’m working on limits a range of data based on a datetime field. I use a SQLite1 database in my automated testing, but ultimately it’s going to run on MySQL2 and possibly others. The ease of SQLite makes this a fairly common setup. ActiveRecord3 helps alleviate cross database issues but it doesn’t cover all cases. You see MySQL stores datetimes to a resolution of one second. Databases like SQLite and PostgreSQL store down to the microsecond (.999999). This leads to a problem.

    1. Version 3.7.7 

    2. Version 5.5.19 

    3. Version 3.2.1 

    Read More
  2. Explaining Include and Extend

    All Rubyists should be familiar with the common definitions for include and extend. You include a module to add instance methods to a class and extend to add class methods. Unfortunately, this common definition isn’t entirely accurate. It fails to explain why we use instance.extend(Module) to add methods to an instance. Shouldn’t it be instance.include(Module)? To figure this out we’re going to start by discussing where methods are stored.

    Read More