1. 06 11月, 2017 1 次提交
  2. 13 8月, 2017 1 次提交
  3. 20 7月, 2017 1 次提交
  4. 18 7月, 2017 2 次提交
  5. 17 7月, 2017 2 次提交
    • S
      Post.joins(:users) should not be affected by `User.current_scope` · 5c71000d
      Sean Griffin 提交于
      This change was introduced by #18109. The intent of that change was to
      specifically apply `unscoped`, not to allow all changes to
      `current_scope` to affect the join. The idea of allowing `current_scope`
      to affect joins is interesting and potentially more consistent, but has
      sever problems associated with it. The fact that we're specifically
      stripping out joins indicates one such problem (and potentially leads to
      invalid queries).
      
      Ultimately it's difficult to reason about what `Posts.joins(:users)`
      actually means if it's affected by `User.current_scope`, and it's
      difficult to specifically control what does or doesn't get added. If we
      were starting from scratch, I don't think I'd have `joins` be affected
      by `default_scope` either, but that's too big of a breaking change to
      make at this point.
      
      With this change, we no longer apply `current_scope` when bringing in
      joins, with the singular exception of the motivating use case which
      introduced this bug, which is providing a way to *opt-out* of having the
      default scope apply to joins.
      
      Fixes #29338.
      5c71000d
    • R
      Enable `Layout/FirstParameterIndentation` cop · 4183d5df
      Ryuta Kamizono 提交于
      We have some indentation cops. But now there is a little inconsistent
      params indentations. Enable `Layout/FirstParameterIndentation` cop to
      prevent newly inconsistent indentation added and auto-correct to
      existing violations.
      4183d5df
  6. 16 7月, 2017 1 次提交
  7. 02 7月, 2017 1 次提交
  8. 01 7月, 2017 1 次提交
  9. 29 6月, 2017 1 次提交
    • R
      Fix to scoping is correctly restored · 99912ed9
      Ryuta Kamizono 提交于
      This regression was caused by #23004.
      
      If STI subclass is using scoping in parent class scoping,
      `current_scope` in subclass is never restored.
      I fixed to restore `current_scope` to previous value correctly.
      99912ed9
  10. 01 6月, 2017 1 次提交
  11. 24 5月, 2017 1 次提交
  12. 13 5月, 2017 1 次提交
    • Y
      Explicitly create necessary data for test · 21e0b675
      yuuji.yaginuma 提交于
      `DefaultScopingWithThreadTest` expects that there are two or more of
      `developers` data, but have not created data in the test.
      Therefore, tests may fail depending on execution order.
      21e0b675
  13. 27 4月, 2017 2 次提交
  14. 31 3月, 2017 1 次提交
  15. 26 3月, 2017 1 次提交
  16. 19 3月, 2017 1 次提交
    • R
      Use `load` rather than `collect` for force loading · 59db5f22
      Ryuta Kamizono 提交于
      Since b644964b `ActiveRecord::Relation` includes `Enumerable` so
      delegating `collect`, `all?`, and `include?` are also unneeded.
      `collect` without block returns `Enumerable` without preloading by that.
      We should use `load` rather than `collect` for force loading.
      59db5f22
  17. 15 3月, 2017 1 次提交
    • F
      Fix fragile test (`AssociationProxyTest#test_save_on_parent_saves_children`) · e9b638fd
      Fumiaki MATSUSHIMA 提交于
      If we run only following tests:
      
      - test/cases/scoping/default_scoping_test.rb
      - test/cases/associations_test.rb
      
      ```
      $ cat Rakefile.test
      require "rake/testtask"
      
      ENV["ARCONN"] = "postgresql"
      
      Rake::TestTask.new do |t|
        t.libs << "test"
        t.test_files = %w(
          test/cases/scoping/default_scoping_test.rb
          test/cases/associations_test.rb
        )
      end
      ```
      
      a test will fail:
      
      ```
      $ bundle exec rake test -f Rakefile.test
      /app/activesupport/lib/active_support/core_ext/enumerable.rb:20: warning: method redefined; discarding old sum
      Using postgresql
      Run options: --seed 11830
      
      # Running:
      
      .........................................................................................F................
      
      Finished in 6.939055s, 15.2759 runs/s, 27.9577 assertions/s.
      
        1) Failure:
      AssociationProxyTest#test_save_on_parent_saves_children [/app/activerecord/test/cases/associations_test.rb:185]:
      Expected: 1
        Actual: 2
      
      106 runs, 194 assertions, 1 failures, 0 errors, 0 skips
      rake aborted!
      Command failed with status (1)
      /usr/local/bin/bundle:22:in `load'
      /usr/local/bin/bundle:22:in `<main>'
      Tasks: TOP => test
      (See full trace by running task with --trace)
      ```
      
      In #28083, change `self.use_transactional_tests` to `false`
      but we forget to clean-up fixture.
      However we don't have to disable transaction except a few tests.
      e9b638fd
  18. 25 2月, 2017 1 次提交
  19. 21 2月, 2017 1 次提交
    • E
      Ensure test threads share a DB connection · d6466beb
      eileencodes 提交于
      This ensures multiple threads inside a transactional test to see consistent
      database state.
      
      When a system test starts Puma spins up one thread and Capybara spins up
      another thread. Because of this when tests are run the database cannot
      see what was inserted into the database on teardown. This is because
      there are two threads using two different connections.
      
      This change uses the statement cache to lock the threads to using a
      single connection ID instead of each not being able to see each other.
      This code only runs in the fixture setup and teardown so it does not
      affect real production databases.
      
      When a transaction is opened we set `lock_thread` to `Thread.current` so
      we can keep track of which connection the thread is using. When we
      rollback the transaction we unlock the thread and then there will be no
      left-over data in the database because the transaction will roll back
      the correct connections.
      
      [ Eileen M. Uchitelle, Matthew Draper ]
      d6466beb
  20. 04 1月, 2017 1 次提交
  21. 02 1月, 2017 1 次提交
  22. 25 12月, 2016 1 次提交
  23. 03 12月, 2016 1 次提交
  24. 29 10月, 2016 1 次提交
  25. 27 10月, 2016 1 次提交
    • X
      let Regexp#match? be globally available · 56832e79
      Xavier Noria 提交于
      Regexp#match? should be considered to be part of the Ruby core library. We are
      emulating it for < 2.4, but not having to require the extension is part of the
      illusion of the emulation.
      56832e79
  26. 17 9月, 2016 1 次提交
  27. 16 8月, 2016 1 次提交
  28. 12 8月, 2016 1 次提交
  29. 08 8月, 2016 1 次提交
  30. 07 8月, 2016 3 次提交
  31. 28 7月, 2016 1 次提交
  32. 25 7月, 2016 1 次提交
  33. 24 7月, 2016 1 次提交
  34. 19 7月, 2016 1 次提交
    • S
      Fix the calling `merge` method at first in a scope · cf2574b1
      suginoy 提交于
      Changing the order of method chaining `merge` and other query
      method such as `joins` should produce the same result.
      
      ```ruby
      class Topic < ApplicationRecord
        scope :safe_chaininig,   -> { joins(:comments).merge(Comment.newest) }
        scope :unsafe_chaininig, -> { merge(Comment.newest).joins(:comments) } #=> NoMethodError
      end
      ```
      cf2574b1
  35. 05 5月, 2016 1 次提交