a = Model.where(“created_at > ‘2011-10-01
00:00:00’”).where(“created_at < ‘2012-01-01
00:00:00’”)
Always results in
ActiveRecord::StatementInvalid (Mysql2::Error: Lost connection to
MySQL server during query: SELECT models.* FROM models
WHERE (created_at > ‘2011-10-01 00:00:00’) AND (created_at <
‘2012-01-01 00:00:00’))
If I leave off one of the conditions it works fine. The raw query via
Mysql2::Client#query works fine, and returns within milliseconds, so
it’s not a timeout issue.
Maybe I could arel, but that’s besides the point. This should work and
it doesn’t, and I’m very curious as to why. I submitted it as an issue.
We’ll see where that goes.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.