1. 20 1月, 2015 1 次提交
    • S
      Don't mutate bind values in `Relation` · 76d7d957
      Sean Griffin 提交于
      In order to better facilitate refactoring, most places that mutated
      `bind_values` have already been removed. One last spot snuck through.
      Since we're no longer mutating the array, it also does not need to be
      duped in `initialize_copy`.
      76d7d957
  2. 10 1月, 2015 1 次提交
    • S
      Properly copy nested bind values from subqueried relations · ec475547
      Sean Griffin 提交于
      This is cropping up all over the place. After a brief dive, I'm really
      not sure why we have `arel.bind_values` at all. A cursory grep didn't
      reveal where they're actually being assigned (it's definitely in AR, not
      in Arel). I'd like to dig further into it, as I'm fairly certain we
      don't actually need it, we just need a way for the predicate builder to
      communicate merged binds upstream.
      
      Fixes #18414
      ec475547
  3. 06 1月, 2015 1 次提交
  4. 05 1月, 2015 1 次提交
  5. 03 12月, 2014 1 次提交
  6. 02 12月, 2014 1 次提交
  7. 30 11月, 2014 2 次提交
    • S
      Update Arel usage for rails/arel#98fc2599 · a975407a
      Sean Griffin 提交于
      `where_sql` now requires that we pass it an engine. None of the manager
      classes take an engine in their constructor.
      a975407a
    • S
      Stop using `Arel::Table.engine` · de239066
      Sean Griffin 提交于
      We never actually make use of it on the table, since we're constructing
      the select manager manually. It looks like if we ever actually were
      grabbing it from the table, we're grossly misusing it since it's meant
      to vary by AR class.
      
      Its existence on `Arel::Table` appears to be purely for convenience
      methods that are never used outside of tests. However, in production
      code it just complicates construction of the tables on the rails side,
      and the plan is to remove it from `Arel::Table` entirely. I'm not
      convinced it needs to live on `SelectManager`, etc either.
      de239066
  8. 21 11月, 2014 1 次提交
  9. 20 11月, 2014 1 次提交
  10. 18 11月, 2014 1 次提交
    • S
      rm `reorder_bind_params` · c01b20b6
      Sean Griffin 提交于
      Arel handles this for us automatically. Updated tests, as BindParam is
      no longer a subclass of SqlLiteral. We should remove the second argument
      to substitute_at entirely, as it's no longer used
      c01b20b6
  11. 02 11月, 2014 3 次提交
    • S
      Use a bound parameter for the "id = " portion of update statements · 4b534152
      Sean Griffin 提交于
      We need to re-order the bind parameters since the AST returned by the
      relation will have the where statement as the first bp, which breaks on
      PG.
      4b534152
    • S
      [ci skip] `Relation#bind` is not public API · b380b1d2
      Sean Griffin 提交于
      b380b1d2
    • S
      Use bind values for joined tables in where statements · 10f75af9
      Sean Griffin 提交于
      In practical terms, this allows serialized columns and tz aware columns
      to be used in wheres that go through joins, where they previously would
      not behave correctly. Internally, this removes 1/3 of the cases where we
      rely on Arel to perform type casting for us.
      
      There were two non-obvious changes required for this. `update_all` on
      relation was merging its bind values with arel's in the wrong order.
      Additionally, through associations were assuming there would be no bind
      parameters in the preloader (presumably because the where would always
      be part of a join)
      
      [Melanie Gilman & Sean Griffin]
      10f75af9
  12. 01 11月, 2014 1 次提交
  13. 29 10月, 2014 1 次提交
    • X
      let's warn with heredocs · b3bfa361
      Xavier Noria 提交于
      The current style for warning messages without newlines uses
      concatenation of string literals with manual trailing spaces
      where needed.
      
      Heredocs have better readability, and with `squish` we can still
      produce a single line.
      
      This is a similar use case to the one that motivated defining
      `strip_heredoc`, heredocs are super clean.
      b3bfa361
  14. 27 10月, 2014 1 次提交
  15. 20 10月, 2014 1 次提交
  16. 11 9月, 2014 1 次提交
  17. 05 9月, 2014 1 次提交
  18. 29 8月, 2014 1 次提交
    • G
      Avoid using heredoc for user warnings · 8c52480b
      Godfrey Chan 提交于
      Using heredoc would enforce line wrapping to whatever column width we decided to
      use in the code, making it difficult for the users to read on some consoles.
      
      This does make the source code read slightly worse and a bit more error-prone,
      but this seems like a fair price to pay since the primary purpose for these
      messages are for the users to read and the code will not stick around for too
      long.
      8c52480b
  19. 19 8月, 2014 1 次提交
  20. 14 8月, 2014 1 次提交
  21. 24 5月, 2014 1 次提交
  22. 23 5月, 2014 1 次提交
  23. 25 4月, 2014 1 次提交
  24. 22 4月, 2014 1 次提交
  25. 08 4月, 2014 1 次提交
    • L
      Build the reverse_order on its proper method. · 6c311e0b
      Lauro Caetano 提交于
      The reverse_order method was using a flag to control if the order should
      be reversed or not. Instead of using this variable just build the reverse order
      inside its proper method.
      
      This implementation was leading to an unexpected behavior when using
      reverse_order and then applying reorder(nil).
      
      Example:
        Before
          Post.order(:name).reverse_order.reorder(nil)
          # => SELECT "posts".* FROM "posts"   ORDER BY "posts"."id" DESC
      
        After
          Post.order(:name).reverse_order.reorder(nil)
         # => SELECT "posts".* FROM "posts"
      6c311e0b
  26. 18 3月, 2014 1 次提交
  27. 17 3月, 2014 1 次提交
  28. 15 3月, 2014 1 次提交
  29. 05 3月, 2014 3 次提交
  30. 01 3月, 2014 1 次提交
  31. 17 2月, 2014 2 次提交
  32. 02 2月, 2014 1 次提交
    • R
      Make arel methods private API · cd93d717
      Rafael Mendonça França 提交于
      Since its conception arel was made to be private API of Active Record.
      If users want to use arel features directly we should provide a way
      using the Active Record API without exposing the arel implementation.
      cd93d717
  33. 31 1月, 2014 1 次提交
  34. 30 1月, 2014 1 次提交
    • Y
      docs, `references` is only used with `includes`. Closes #13727. · 9632c986
      Yves Senn 提交于
      There is no gain in `referencing` tables that are not used for preloading.
      Furthermore it will break if polymorphic associations are invloved. This
      is because `references_eager_loaded_tables?` uses all `reference_values`
      to decide wether to `eager_load` or `preload`.
      9632c986