Seth Willits
2012-Mar-29 21:50 UTC
[Rails] ActiveRecord Bug — Dropped Connection with two conditions
Using 3.2.2, doing: 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. Any ideas? I''m stumped. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
thiagocifani
2012-Mar-30 02:21 UTC
Re: [Rails] ActiveRecord Bug — Dropped Connection with two conditions
I don''t know what are trying to do, but why are you not using arel approach for 2 conditions statements, You could try this possibility users.where(users[:name].eq(''bob'').and(users[:age].lt(25))) if you have any misunderstand please try to look at arel documentation or github readme https://github.com/rails/arel regards 2012/3/29 Seth Willits <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>> Using 3.2.2, doing: > > 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. > > > Any ideas? I''m stumped. > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- thiagocifani http://thiagocifani.wordpress.com/ twitter.com/thiagocifani del.icio.us/thiagocifani <http://del.icio.us/thiagocifani> -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Seth Willits
2012-Apr-01 21:21 UTC
[Rails] Re: ActiveRecord Bug — Dropped Connection with two conditions
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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.