1. 01 7月, 2017 1 次提交
  2. 30 6月, 2017 2 次提交
  3. 29 6月, 2017 12 次提交
  4. 28 6月, 2017 5 次提交
  5. 27 6月, 2017 3 次提交
  6. 26 6月, 2017 2 次提交
  7. 25 6月, 2017 2 次提交
  8. 24 6月, 2017 2 次提交
  9. 22 6月, 2017 5 次提交
  10. 21 6月, 2017 6 次提交
    • K
      Avoid begin/rescue in fixture quoting · fa14332a
      Kir Shatrov 提交于
      Scalar values like arrays and hashes can't be inserted
      directly into table. Previously, the way to determine if
      the value is scalar was to try quoting it. If `quote` raised
      with an error than the value has to be converted to YAML.
      
      This flow is not very obvious. Ideally we could have
      a `quotable?` method in the connection, but I think
      that we can avoid begin/rescue block by simply checking
      if the value is Array or Hash.
      
      https://github.com/rails/rails/commit/aa31d21f5f4fc4d679e74a60f9df9706da7de373
      fa14332a
    • M
      Keep INNER JOIN when merging relations · 249ddd0c
      Maxime Lapointe 提交于
      Doing `Author.joins(:posts).merge(Post.joins(:comments))` does this
      `SELECT ... INNER JOIN posts ON... LEFT OUTER JOIN comments ON...`
      instead of doing
      `SELECT ... INNER JOIN posts ON... INNER JOIN comments ON...`.
      
      This behavior is unexpected and makes little sense as, basically, doing
      `Post.joins(:comments)` means I want posts that have comments. Turning
      it to a LEFT JOIN means I want posts and join the comments data, if
      any.
      
      We can see this problem directly in the existing tests.
      The test_relation_merging_with_merged_joins_as_symbols only does joins
      from posts to comments to ratings while the ratings fixture isn't
      loaded, but the count is non-zero.
      249ddd0c
    • J
      Clear offset cache on CollectionProxy reset/reload · c7f669af
      John Hawthorn 提交于
      The `@offsets` cache is used by FinderMethods to cache records found by
      find_nth. This cache is cleared in AR::Relation#reset, but not in
      CollectionProxy#reset or CollectionProxy#reload.
      
      Because of this, since #29098, calling #first/#find_nth/etc after
      calling #reload or #reset on an association could return a stale record.
      This is an issue both when the full association target is loaded and
      when the item is loaded in #find_nth.
      
      This commit solves the problem by clearing the `@offsets` cache in
      CollectionProxy#reset and CollectionProxy#reload.
      c7f669af
    • B
      Fix ActiveRecord::Persistence#touch with locking · 4d1264cb
      bogdanvlviv 提交于
      `ActiveRecord::Persistence#touch` does not work well when optimistic
      locking enabled and `locking_column`, without default value, is null in
      the database.
      4d1264cb
    • B
      Fix destroy with locking_column value null · f08bc757
      bogdanvlviv 提交于
      Fix destroying existing object does not work well when optimistic
      locking enabled and `locking column` is null in the database.
      
      Follow 22a822e5, #28914
      f08bc757
    • K
      Use bulk INSERT to insert fixtures · 4ee42379
      Kir Shatrov 提交于
      Improves the performance from O(n) to O(1).
      Previously it would require 50 queries to
      insert 50 fixtures. Now it takes only one query.
      
      Disabled on sqlite which doesn't support multiple inserts.
      4ee42379