1. 24 12月, 2016 2 次提交
  2. 23 12月, 2016 1 次提交
  3. 06 12月, 2016 1 次提交
  4. 24 11月, 2016 1 次提交
    • D
      Restore RecordNotFound when *_ids= can't find records by ID · 15e2da65
      Dominic Cleal 提交于
      9c9fb19b changed the behaviour of the _ids= setters for associations to
      raise an AssociationTypeMismatch when unknown IDs are given:
      
          Class: <ActiveRecord::AssociationTypeMismatch>
          Message: <"Developer(#43811860) expected, got NilClass(#16732720)">
      
      This restores the original ActiveRecord::RecordNotFound exception with a
      much clearer error message:
      
          Class: <ActiveRecord::RecordNotFound>
          Message: <"Couldn't find all Developers with 'id': (1, -9999) [WHERE \"contracts\".\"company_id\" = ?] (found 1 results, but was looking for 2)">
      
      Fixes #25719
      15e2da65
  5. 14 11月, 2016 1 次提交
  6. 09 11月, 2016 1 次提交
    • R
      Should except `:distinct` rather than `:order` for `exists?` · 2bf7c300
      Ryuta Kamizono 提交于
      Records fetching order is very important for performance if `limit` is
      presented. Should not except the order in the case.
      
      And `exists?` replaces select list to `1 AS one` therefore `:distinct`
      is useless (`DISTINCT 1 AS one`). And PostgreSQL raises the following
      error if `:distinct` and `:order` are used in the same time.
      
      ```
      ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
      ```
      2bf7c300
  7. 06 11月, 2016 1 次提交
  8. 29 10月, 2016 1 次提交
  9. 27 10月, 2016 2 次提交
  10. 22 10月, 2016 1 次提交
  11. 04 10月, 2016 1 次提交
  12. 27 9月, 2016 1 次提交
  13. 23 9月, 2016 1 次提交
  14. 14 9月, 2016 1 次提交
  15. 11 9月, 2016 1 次提交
  16. 10 9月, 2016 1 次提交
  17. 06 9月, 2016 2 次提交
  18. 03 9月, 2016 1 次提交
  19. 01 9月, 2016 1 次提交
    • S
      Revert "Extract `PredicateBuilder::CaseSensitiveHandler`" · 84efde74
      Sean Griffin 提交于
      This reverts commit 3a1f6fe7.
      
      This commit takes the code in a direction that I am looking to avoid.
      The predicate builder should be purely concerned with AST construction
      as it matters to methods like `where`. Things like case sensitivity
      should continue to be handled elsewhere.
      84efde74
  20. 31 8月, 2016 1 次提交
    • S
      Override `respond_to_missing?` instead of `respond_to?` when possible · 03d3f036
      Sean Griffin 提交于
      This was almost every case where we are overriding `respond_to?` in a
      way that mirrors a parallel implementation of `method_missing`. There is
      one remaining case in Active Model that should probably do the same
      thing, but had a sufficiently strange implementation that I want to
      investigate it separately.
      
      Fixes #26333.
      03d3f036
  21. 26 8月, 2016 1 次提交
  22. 23 8月, 2016 1 次提交
    • B
      Remove over meta programming in AR::Relation · 5b42628e
      Bogdan Gusiev 提交于
      Introduced low level methods #set_value and #get_value for setting query attributes:
      
        relation.set_value(:where, {id: 1})
        relation.get_value(:includes)
      
      Used those internally when working with relation's attributes
      at the abstract level
      5b42628e
  23. 18 8月, 2016 1 次提交
  24. 17 8月, 2016 1 次提交
  25. 16 8月, 2016 5 次提交
    • R
      Finder bang method should call non bang method · 9d008884
      Ryuta Kamizono 提交于
      Otherwise CollectionProxy's bang methdos cannot respect dirty target.
      9d008884
    • M
      Fix count which would sometimes force a DISTINCT · 0aae7806
      Maxime Lapointe 提交于
      The current behaviour of checking if there is a LEFT OUTER JOIN arel
      node to detect if we are doing eager_loading is wrong. This problem
      wasn't frequent before as only some pretty specific cases would add
      a LEFT OUTER JOIN arel node. However, the recent new feature
      left_outer_joins also add this node and made this problem happen
      frequently.
      
      Since in the perform_calculation function, we don't have access to
      eager_loading information, I had to extract the logic for the distinct
      out to the calculate method.
      
      As I was in the file for left_outer_join tests, I fixed a few that had
      bugs and I replaced some that were really weak with something that
      will catch more issues.
      
      In relation tests, the first test I changed would have failed if it
      had validated the hash returned by count instead of just checking how
      many pairs were in it. This is because this merge of join currently
      transforms the join node into an outer join node, which then made
      count do a distinct. So before this change, the return was
      {1=>1, 4=>1, 5=>1}.
      0aae7806
    • R
      Extract `PredicateBuilder::CaseSensitiveHandler` · 3a1f6fe7
      Ryuta Kamizono 提交于
      Currently uniqueness validator is coupled with building Arel ASTs.
      This commit extracts `PredicateBuilder::CaseSensitiveHandler` for
      decouple the building Arel ASTs.
      3a1f6fe7
    • R
      Do not handle as an associated predicate if a table has the column · c6a62dc3
      Ryuta Kamizono 提交于
      If handled as an associated predicate even though a table has the
      column, will generate invalid SQL by valid column name treated as a
      table name.
      c6a62dc3
    • R
      Add three new rubocop rules · 55f9b812
      Rafael Mendonça França 提交于
      Style/SpaceBeforeBlockBraces
      Style/SpaceInsideBlockBraces
      Style/SpaceInsideHashLiteralBraces
      
      Fix all violations in the repository.
      55f9b812
  26. 15 8月, 2016 1 次提交
  27. 14 8月, 2016 1 次提交
  28. 13 8月, 2016 1 次提交
  29. 11 8月, 2016 2 次提交
    • R
      `where` by `array|range` attribute with array or range value · f79d55a4
      Ryuta Kamizono 提交于
      Currently predicate builder cannot build a predicate for `array|range`
      attribute. This commit fixes the issue.
      
      Related #25671.
      f79d55a4
    • R
      Make association queries to preparable: Step 1 · c30ff2b9
      Ryuta Kamizono 提交于
      Currently association queries cannot be preparable.
      
      ```ruby
        Post.where(author_id: 1).to_a
        # => SELECT "posts".* FROM "posts" WHERE "posts"."author_id" = ?  [["author_id", 1]]
      
        Post.where(author: 1).to_a
        # => SELECT "posts".* FROM "posts" WHERE "posts"."author_id" = 1
      ```
      
      To make association queries to preparable, it should be handled in
      `create_binds_for_hash`. This change is a first step for it.
      c30ff2b9
  30. 08 8月, 2016 2 次提交
  31. 07 8月, 2016 1 次提交