1. 27 5月, 2016 1 次提交
  2. 07 5月, 2016 1 次提交
    • S
      Allow the connection adapters to determine the order of bind params · 96f3f3d8
      Sean Griffin 提交于
      In 5.0 we use bind parameters for limit and offset, while in 4.2 we used
      the values directly. The code as it was written assumed that limit and
      offset worked as `LIMIT ? OFFSET ?`. Both Oracle and SQL Server have a
      different syntax, where the offset is stated before the limit. We
      delegate this behavior to the connection adapter so that these adapters
      are able to determine how the bind parameters are flattened based on
      what order their specification has the various clauses appear.
      
      Fixes #24775
      96f3f3d8
  3. 17 2月, 2016 1 次提交
  4. 13 2月, 2016 1 次提交
  5. 04 2月, 2016 2 次提交
  6. 27 1月, 2016 1 次提交
  7. 13 1月, 2016 1 次提交
  8. 05 1月, 2016 1 次提交
  9. 31 12月, 2015 1 次提交
  10. 15 12月, 2015 3 次提交
    • Y
      remove extra spaces from deprecation message · 08780eff
      yuuji.yaginuma 提交于
      ```
      # before
      DEPRECATION WARNING:               Time columns will become time zone aware in Rails 5.1. This
                    still causes `String`s to be parsed as if they were in `Time.zone`,
                    and `Time`s to be converted to `Time.zone`.
      
                    To keep the old behavior, you must add the following to your initializer:
      
                        config.active_record.time_zone_aware_types = [:datetime]
      
                    To silence this deprecation warning, add the following:
      
                        config.active_record.time_zone_aware_types << :time
      ```
      
      ```
      # after
      DEPRECATION WARNING: Time columns will become time zone aware in Rails 5.1. This
      still causes `String`s to be parsed as if they were in `Time.zone`,
      and `Time`s to be converted to `Time.zone`.
      
      To keep the old behavior, you must add the following to your initializer:
      
          config.active_record.time_zone_aware_types = [:datetime]
      
      To silence this deprecation warning, add the following:
      
          config.active_record.time_zone_aware_types << :time
      ```
      08780eff
    • 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
    • S
      Deprecate limit strings with commas · e12c2a6d
      Sean Griffin 提交于
      Some backends allow `LIMIT 1,2` as a shorthand for `LIMIT 1 OFFSET 2`.
      Supporting this in Active Record massively complicates using bind
      parameters for limit and offset, and it's trivially easy to build an
      invalid SQL query by also calling `offset` on the same `Relation`.
      
      This is a niche syntax that is only supported by a few adapters, and can
      be trivially worked around by calling offset explicitly.
      e12c2a6d
  11. 14 12月, 2015 2 次提交
    • 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
    • S
      Deprecate limit strings with commas · 4358b0d1
      Sean Griffin 提交于
      Some backends allow `LIMIT 1,2` as a shorthand for `LIMIT 1 OFFSET 2`.
      Supporting this in Active Record massively complicates using bind
      parameters for limit and offset, and it's trivially easy to build an
      invalid SQL query by also calling `offset` on the same `Relation`.
      
      This is a niche syntax that is only supported by a few adapters, and can
      be trivially worked around by calling offset explicitly.
      4358b0d1
  12. 26 11月, 2015 1 次提交
  13. 04 11月, 2015 1 次提交
  14. 02 11月, 2015 1 次提交
  15. 31 10月, 2015 1 次提交
  16. 25 10月, 2015 1 次提交
  17. 18 10月, 2015 2 次提交
  18. 17 10月, 2015 1 次提交
  19. 16 10月, 2015 1 次提交
  20. 14 10月, 2015 1 次提交
    • Y
      applies new doc guidelines to Active Record. · 428d47ad
      Yves Senn 提交于
      The focus of this change is to make the API more accessible.
      References to method and classes should be linked to make it easy to
      navigate around.
      
      This patch makes exzessiv use of `rdoc-ref:` to provide more readable
      docs. This makes it possible to document `ActiveRecord::Base#save` even
      though the method is within a separate module
      `ActiveRecord::Persistence`. The goal here is to bring the API closer to
      the actual code that you would write.
      
      This commit only deals with Active Record. The other gems will be
      updated accordingly but in different commits. The pass through Active
      Record is not completely finished yet. A follow up commit will change
      the spots I haven't yet had the time to update.
      
      /cc @fxn
      428d47ad
  21. 13 10月, 2015 2 次提交
  22. 08 10月, 2015 1 次提交
  23. 02 10月, 2015 1 次提交
  24. 26 9月, 2015 2 次提交
  25. 22 9月, 2015 1 次提交
  26. 05 9月, 2015 1 次提交
    • S
      #where fails if opts.responds_to?(:==) unexpectedly · c431f175
      Samuel Williams 提交于
      Sometimes opts passed in might respond to ==, e.g. `Arel::Nodes::Grouping`. In this case, `opts == :chain` returns `Arel::Nodes::Equality` which causes odd behaviour. Prefer `if :chain == opts` which guarantees that `Symbol#==` would be invoked. Alternatively consider `eql?`.
      c431f175
  27. 20 6月, 2015 1 次提交
    • S
      Include `Enumerable` in `ActiveRecord::Relation` · b644964b
      Sean Griffin 提交于
      After discussing, we've decided it makes more sense to include it. We're
      already forwarding every conflicting method to `to_a`, and there's no
      conflation of concerns. `Enumerable` has no mutating methods, and it
      just allows us to simplify the code. No existing methods will have a
      change in behavior. Un-overridden Enumerable methods will simply
      delegate to `each`.
      
      [Sean Griffin & bogdan]
      b644964b
  28. 31 5月, 2015 1 次提交
    • S
      Ensure symbols passed to `select` are always quoted · 0ef7e73f
      Sean Griffin 提交于
      Our general contract in Active Record is that strings are assumed to be
      SQL literals, and symbols are assumed to reference a column. If a from
      clause is given, we shouldn't include the table name, but we should
      still quote the value as if it were a column.
      
      Upon fixing this, the tests were still failing on SQLite. This was
      because the column name being returned by the query was `"\"join\""`
      instead of `"join"`. This is actually a bug in SQLite that was fixed a
      long time ago, but I was using the version of SQLite included by OS X
      which has this bug. Since I'm guessing this will be a common case for
      contributors, I also added an explicit check with a more helpful error
      message.
      
      Fixes #20360
      0ef7e73f
  29. 26 5月, 2015 1 次提交
    • Y
      deprecate `Relation#uniq` use `Relation#distinct` instead. · adfab2dc
      Yves Senn 提交于
      See #9683 for the reasons we switched to `distinct`.
      
      Here is the discussion that triggered the actual deprecation #20198.
      
      `uniq`, `uniq!` and `uniq_value` are still around.
      They will be removed in the next minor release after Rails 5.
      adfab2dc
  30. 19 5月, 2015 1 次提交
  31. 25 2月, 2015 2 次提交
  32. 29 1月, 2015 1 次提交