1. 04 5月, 2016 1 次提交
  2. 13 4月, 2016 1 次提交
    • S
      Allow symbols using "dot notation" to be passed to where · 714ab8cb
      Sean Griffin 提交于
      In 04ac5655 I assumed that we would
      never want to pass the "table_name.column_name" form to where with a
      symbol. However, in Ruby 2.2 and later, you can quote symbols using the
      new hash syntax, so it's a semi-reasonable thing to do if we want to
      support the dot notation (which I'd rather deprecate, but that would be
      too painful of a migration).
      
      Instead we've changed the definition of "this is a table name with a
      dot" to when the value associated is a hash. It would make very little
      sense to write `where("table_name.column_name": { foo: :bar })` in any
      scenario (other than equality for a JSON column which we don't support
      through `where` in this way).
      
      Close #24514.
      714ab8cb
  3. 28 2月, 2016 4 次提交
  4. 23 2月, 2016 1 次提交
  5. 13 2月, 2016 2 次提交
  6. 02 2月, 2016 1 次提交
  7. 28 1月, 2016 1 次提交
  8. 19 12月, 2015 1 次提交
    • R
      Fix... · a093afd8
      Ryuta Kamizono 提交于
      Fix `test_find_with_order_on_included_associations_with_construct_finder_sql_for_association_limiting_and_is_distinct` to NULL-agnostic way
      
      The sort order of NULL depends on the RDBS implementation. This commit
      is to fix the test to NULL-agnostic way.
      
      Example:
      
          ```
          activerecord_unittest=# SELECT  DISTINCT "posts"."id", author_addresses_authors.id AS alias_0 FROM "posts" LEFT OUTER JOIN "authors" ON "authors"."id" = "posts"."author_id" LEFT OUTER JOIN "author_addresses" ON "author_addresses"."id" = "authors"."author_address_id" LEFT OUTER JOIN "categorizations" ON "categorizations"."category_id" = "posts"."id" LEFT OUTER JOIN "authors" "authors_posts" ON "authors_posts"."id" = "categorizations"."author_id" LEFT OUTER JOIN "author_addresses" "author_addresses_authors" ON "author_addresses_authors"."id" = "authors_posts"."author_address_id" ORDER BY author_addresses_authors.id DESC;
           id | alias_0
          ----+---------
            1 |
            2 |
            3 |
            4 |
            5 |
            6 |
            7 |
            8 |
            9 |
           10 |
           11 |
            1 |       1
          (12 rows)
          ```
      
          ```
          root@localhost [activerecord_unittest] > SELECT  DISTINCT `posts`.`id`, author_addresses_authors.id AS alias_0 FROM `posts` LEFT OUTER JOIN `authors` ON `authors`.`id` = `posts`.`author_id` LEFT OUTER JOIN `author_addresses` ON `author_addresses`.`id` = `authors`.`author_address_id` LEFT OUTER JOIN `categorizations` ON `categorizations`.`category_id` = `posts`.`id` LEFT OUTER JOIN `authors` `authors_posts` ON `authors_posts`.`id` = `categorizations`.`author_id` LEFT OUTER JOIN `author_addresses` `author_addresses_authors` ON `author_addresses_authors`.`id` = `authors_posts`.`author_address_id` ORDER BY author_addresses_authors.id DESC;
          +----+---------+
          | id | alias_0 |
          +----+---------+
          |  1 |       1 |
          |  3 |    NULL |
          |  1 |    NULL |
          |  2 |    NULL |
          |  4 |    NULL |
          |  5 |    NULL |
          |  6 |    NULL |
          |  7 |    NULL |
          |  8 |    NULL |
          |  9 |    NULL |
          | 10 |    NULL |
          | 11 |    NULL |
          +----+---------+
          12 rows in set (0.00 sec)
          ```
      a093afd8
  9. 18 12月, 2015 1 次提交
    • M
      Implement limit & offset for ourselves · 04309aee
      Matthew Draper 提交于
      We know the query will return exactly one row for each entry in the
      `ids` array, so we can do all the limit/offset calculations on that
      array, in advance.
      
      I also split our new ordered-ids behaviour out of the existing
      `find_some` method: especially with this change, the conditionals were
      overwhelming the actual logic.
      04309aee
  10. 15 12月, 2015 1 次提交
    • S
      Use a bind param for `LIMIT` and `OFFSET` · af3dc42e
      Sean Griffin 提交于
      We currently generate an unbounded number of prepared statements when
      `limit` or `offset` are called with a dynamic argument. This changes
      `LIMIT` and `OFFSET` to use bind params, eliminating the problem.
      
      `Type::Value#hash` needed to be implemented, as it turns out we busted
      the query cache if the type object used wasn't exactly the same object.
      
      This drops support for passing an `Arel::Nodes::SqlLiteral` to `limit`.
      Doing this relied on AR internals, and was never officially supported
      usage.
      
      Fixes #22250.
      af3dc42e
  11. 14 12月, 2015 1 次提交
    • S
      Use a bind param for `LIMIT` and `OFFSET` · 574f2556
      Sean Griffin 提交于
      We currently generate an unbounded number of prepared statements when
      `limit` or `offset` are called with a dynamic argument. This changes
      `LIMIT` and `OFFSET` to use bind params, eliminating the problem.
      
      `Type::Value#hash` needed to be implemented, as it turns out we busted
      the query cache if the type object used wasn't exactly the same object.
      
      This drops support for passing an `Arel::Nodes::SqlLiteral` to `limit`.
      Doing this relied on AR internals, and was never officially supported
      usage.
      
      Fixes #22250.
      574f2556
  12. 21 11月, 2015 1 次提交
  13. 06 10月, 2015 1 次提交
  14. 23 9月, 2015 1 次提交
  15. 17 9月, 2015 1 次提交
  16. 09 9月, 2015 1 次提交
  17. 08 8月, 2015 1 次提交
  18. 20 6月, 2015 1 次提交
  19. 06 6月, 2015 1 次提交
  20. 04 6月, 2015 2 次提交
  21. 30 5月, 2015 1 次提交
  22. 09 5月, 2015 1 次提交
  23. 23 3月, 2015 1 次提交
  24. 05 1月, 2015 1 次提交
  25. 23 12月, 2014 1 次提交
  26. 05 12月, 2014 1 次提交
  27. 04 12月, 2014 1 次提交
  28. 03 12月, 2014 1 次提交
    • M
      Refactor `build_from_hash` to convert dot notation to hash first · fcc3cbc7
      Melanie Gilman 提交于
      This ensures that we're handling all forms of nested tables the same way.
      
      We're aware that the `convert_dot_notation_to_hash` method will cause a
      performance hit, and we intend to come back to it once we've refactored some of
      the surrounding code.
      
      [Melissa Xie & Melanie Gilman]
      fcc3cbc7
  29. 29 11月, 2014 1 次提交
  30. 14 11月, 2014 1 次提交
  31. 03 11月, 2014 1 次提交
  32. 01 11月, 2014 1 次提交
    • S
      Treat strings greater than int max value as out of range · e62fff40
      Sean Griffin 提交于
      Sufficiently large integers cause `find` and `find_by` to raise
      `StatementInvalid` instead of `RecordNotFound` or just returning `nil`.
      Given that we can't cast to `nil` for `Integer` like we would with junk
      data for other types, we raise a `RangeError` instead, and rescue in
      places where it would be highly unexpected to get an exception from
      casting.
      
      Fixes #17380
      e62fff40
  33. 20 9月, 2014 1 次提交
    • G
      Fix find_by with associations not working with adequate record · 90f99689
      Godfrey Chan 提交于
      For now, we will just skip the cache when a non-column key is used in the hash.
      If the future, we can probably move some of the logic in PredicateBuilder.expand
      up the chain to make caching possible for association queries.
      
      Closes #16903
      Fixes #16884
      90f99689
  34. 07 9月, 2014 1 次提交
    • C
      Fix query with nested array in Active Record · 72d1663b
      Cristian Bica 提交于
      `User.where(id: [[1,2],3])` was equal to `User.where(id:[1, 2, 3])`
      in Rails 4.1.x but because of some refactoring in Arel this stopped
      working in 4.2.0. This fixes it in Rails.
      
      [Dan Olson & Cristian Bica]
      72d1663b
  35. 26 8月, 2014 1 次提交