I have a table that is large, and I work for a growing company. We will use find_each or find_each_in_batches, but as our code base grows and the number of hands touching the code increases, I''m concerned that we may risk releasing code that will perform terribly in production. Our test environments do not have millions of records, so we''re unlikely to catch an error until we push to production and see our systems grind to a halt. I''m wondering if there''s an easy way to force the use of find_each (or find_in_batches) for all queries written against my model. This would be one change we could make and we''d forever catch the mistake at the test phase vs having to always worry that our new guy will write perfectly valid code and we''ll just forget that you can''t use that code on that model. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/WX5EB40UnXQJ. 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.
use MyModel.methods.grep could catch this On Feb 24, 2012 10:01 AM, "John Hinnegan" <john.hinnegan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I have a table that is large, and I work for a growing company. We willuse find_each or find_each_in_batches, but as our code base grows and the number of hands touching the code increases, I''m concerned that we may risk releasing code that will perform terribly in production. Our test environments do not have millions of records, so we''re unlikely to catch an error until we push to production and see our systems grind to a halt.> > I''m wondering if there''s an easy way to force the use of find_each (orfind_in_batches) for all queries written against my model. This would be one change we could make and we''d forever catch the mistake at the test phase vs having to always worry that our new guy will write perfectly valid code and we''ll just forget that you can''t use that code on that model.> > > -- > You received this message because you are subscribed to the Google Groups"Ruby on Rails: Talk" group.> To view this discussion on the web visithttps://groups.google.com/d/msg/rubyonrails-talk/-/WX5EB40UnXQJ.> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email torubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org> For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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.
On 24 February 2012 02:01, John Hinnegan <john.hinnegan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:>Our test environments do not have millions of records, so we''re unlikely to catch an > error until we push to production and see our systems grind to a halt.Then they''re not very good test systems. They should be as close a possible to production to highlight exactly this kind of thing.> vs having to always worry that our new guy will write perfectly valid > code and we''ll just forget that you can''t use that code on that model.Code reviews? Training? I''m sorry to say I don''t think my post directly answers your issue (have you tried aliasing/overloading AR::Base.find?), but that''s because I think your solution is dealing with the symptoms rather than the core of your problem. -- 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.