1. 21 12月, 2015 2 次提交
  2. 19 12月, 2015 1 次提交
  3. 18 12月, 2015 5 次提交
  4. 17 12月, 2015 8 次提交
  5. 16 12月, 2015 4 次提交
  6. 15 12月, 2015 13 次提交
    • S
      Allow users to pass flags from database.yml · 46fe546c
      Stephen Blackstone 提交于
      Fix white-space
      
      Add test case demonstrating flags are received by the adapter
      46fe546c
    • 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
    • M
      Use a real migration version number in docs · 97c77160
      Matthew Draper 提交于
      Even though this means more things to change when we bump after a
      release, it's more important that our examples are directly copyable.
      97c77160
    • M
      Schema uses current migration API · 6d2469da
      Matthew Draper 提交于
      6d2469da
    • M
      In 4.2 migrations, `timestamps` defaulted to `null: true` · badaf353
      Matthew Draper 提交于
      .. it also showed a deprecation warning, but we obviously needn't retain
      that.
      badaf353
    • M
      Find the delegate, even in a deeper inheritance tree · f37d92c4
      Matthew Draper 提交于
      f37d92c4
    • M
      Use a deliberately-invalid migration version in all doc examples · c0af95e0
      Matthew Draper 提交于
      If we use a real version, at best that'll be an onerous update required
      for each release; at worst, it will encourage users to write new
      migrations against an older version than they're using.
      
      The other option would be to leave these bare, without any version
      specifier. But as that's just a variant spelling of "4.2", it would seem
      to raise the same concerns as above.
      c0af95e0
    • M
      Add migration versioning via Migration subclasses · 6940dc86
      Matthew Draper 提交于
      6940dc86
    • S
      Revert "Perform a more efficient query in `Relation#any?`" · 4ecabed2
      Sean Griffin 提交于
      This reverts commit 6d5b1fdf.
      
      `eager_load` and `references` can include hashes, which won't match up
      with `references`
      
      A test case has been added to demonstrate the problem
      4ecabed2
    • S
      Perform a more efficient query in `Relation#any?` · 6d5b1fdf
      Sean Griffin 提交于
      This was changed in 421c81bd, as `exists?` blows up if you are eager
      loading a polymorphic association, as it'll try to construct a join to
      that table. The previous change decided to execute a `count` instead,
      which wouldn't join.
      
      Of course, the only time we actually need to perform a join on the eager
      loaded values (which would perform a left outer join) is if they're
      being referenced in the where clause. This doesn't affect inner joins.
      6d5b1fdf
    • V
      61e50814
  7. 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
  8. 12 12月, 2015 1 次提交
  9. 07 12月, 2015 3 次提交
    • Y
      Typo correction · bcf89f44
      Yves Siegrist 提交于
      In the doc the `dependent` option was set with: `dependent: destroy`.
      This is not working because destroy would call the method of the activerecord::base object.
      
      The right way is: `dependent: :destroy`
      bcf89f44
    • A
      Make sure we touch all the parents when touch_later. · e7c48db5
      Arthur Neves 提交于
      The problem was that when saving an object, we would
      call touch_later on the parent which wont be saved immediteally, and
      it wont call any callbacks. That was working one level up because
      we were calling touch, during the touch_later commit phase. However that still
      didnt solve the problem when you have a 3+ levels of parents to be touched,
      as calling touch would affect the parent, but it would be too late to run callbacks
      on its grand-parent.
      
      The solution for this, is instead, call touch_later upwards when the first
      touch_later is called. So we make sure all the timestamps are updated without relying
      on callbacks.
      
      This also removed the hard dependency BelongsTo builder had with the TouchLater module.
      So we can still have the old behaviour if TouchLater module is not included.
      
      [fixes 5f5e6d92]
      [related #19324]
      e7c48db5
    • G
      Introduce after_{create,update,delete}_commit callbacks · 5a300b2e
      Genadi Samokovarov 提交于
      Those are actually shortcuts for `after_commit`.
      
      Before:
      
          after_commit :add_to_index_later, on: :create
          after_commit :update_in_index_later, on: :update
          after_commit :remove_from_index_later, on: :destroy
      
      After:
      
          after_create_commit  :add_to_index_later
          after_update_commit  :update_in_index_later
          after_destroy_commit :remove_from_index_later
      5a300b2e
  10. 06 12月, 2015 1 次提交