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.
Read More-
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. -
Explaining Include and Extend
All Rubyists should be familiar with the common definitions for
Read Moreincludeandextend. Youincludea module to add instance methods to a class andextendto add class methods. Unfortunately, this common definition isn’t entirely accurate. It fails to explain why we useinstance.extend(Module)to add methods to an instance. Shouldn’t it beinstance.include(Module)? To figure this out we’re going to start by discussing where methods are stored.