Nathan Youngman
2013-Jul-30 16:14 UTC
Please provide a formal explanation of Rails 3.x clobbering behavior
Hi, I''m sure you''re well aware of the email incident that GitHub experienced when upgrading to Rails 3.2.13 https://github.com/blog/1440-today-s-email-incident A number of regressions were resolved, though some are likely to remain open to avoid symbol attacks while maintaining some semblance of backwards compatibility. There is quite a bit of discussion on issue #9813: https://github.com/rails/rails/issues/9813 I''ve attempted to test the issue GitHub blogged about against multiple versions of Rails using Appraisal: http://stackoverflow.com/questions/17867202/why-am-i-unable-to-reproduce-the-github-email-incident-issue And we are currently doing a query-by-query comparison of Rails 3.2.12 and Rails 3.2.14 by logging all queries generated during a test suite run: https://gist.github.com/nathany/6091516 Still we''re a little uncomfortable rolling 3.2.14 into production due to the crashes we had with 3.2.13, and I personally don''t feel like I fully understand all the issues. I would really like to see a formal response to the GitHub email incident, preferably on the Rails blog. What is the clobbering behaviour? What actions cause an ActiveRelation merge? What should we avoid or watch out for? Thanks, Nathan. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.
Andrew Vit
2013-Aug-01 21:40 UTC
Re: Please provide a formal explanation of Rails 3.x clobbering behavior
Agreed, it''s all a bit too spooky right now. I started compiling a table of different queries and their behaviour (clobber vs. append) between 3.2.12 and 3.2.14. I''m not totally there yet, but I''ll put it up when I think I have a good understanding so we can know exactly what tests we need to write. Here are two failing ones to start, based on pre-3.2.13 as the standard: diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index f14eee2..93e0b61 100644--- a/activerecord/test/cases/relations_test.rb+++ b/activerecord/test/cases/relations_test.rb @@ -378,6 +378,10 @@ class RelationTest < ActiveRecord::TestCase assert_equal Developer.find_all_by_name(''David'').map(&:id).sort, developers end + def test_default_scope_with_conditions_hash_conflict+ assert_equal [], DeveloperCalledJamis.where(name: ''David'').to_a+ end+ def test_loading_with_one_association posts = Post.preload(:comments) post = posts.find { |p| p.id == 1 } @@ -668,6 +672,11 @@ class RelationTest < ActiveRecord::TestCase assert_equal [developers(:poor_jamis)], dev_with_count.to_a end + def test_relation_merging_with_where_values+ devs = Developer.where(name: ''David'').merge(Developer.where(name: ''Jamis''))+ assert_equal [], devs.to_a+ end+ Andrew -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.