"undefined method `' for nil:NilClass" when query returns many results
I have a rails 3.2 app that uses 2 databases. One database is the default rails database (sqlite). The other database is MicrosoftSQL ODBC running on SQL Server 2008. It is connected to several factory machines, and it logs things like how many pieces the machine has produced.
New rows are added to this database (it's just one big table... I did not design this) about every 3 seconds, so there are a LOT of rows.
Queries are performed based on a time frame. Here's a simplified version of a query:
@results = History.find_by_sql("SELECT * WHERE created_at > SomeStartTime AND created_at < SomeEndTime")
The query works fine for time spans up to a few hours, until it returns more than about 3500 results. Any time frames longer than that and I get the error
undefined method `' for nil:NilClass
Does anyone know what's going on here?
Ok, I'm an idiot. I was running in development mode, and apparently any query that takes longer than half a second automatically does this.