1. 24 1月, 2015 2 次提交
  2. 22 1月, 2015 1 次提交
  3. 21 1月, 2015 1 次提交
    • S
      Introduce `ActiveRecord::Base#accessed_fields` · be9b6803
      Sean Griffin 提交于
      This method can be used to see all of the fields on a model which have
      been read. This can be useful during development mode to quickly find
      out which fields need to be selected. For performance critical pages, if
      you are not using all of the fields of a database, an easy performance
      win is only selecting the fields which you need. By calling this method
      at the end of a controller action, it's easy to determine which fields
      need to be selected.
      
      While writing this, I also noticed a place for an easy performance win
      internally which I had been wanting to introduce. You cannot mutate a
      field which you have not read. Therefore, we can skip the calculation of
      in place changes if we have never read from the field. This can
      significantly speed up methods like `#changed?` if any of the fields
      have an expensive mutable type (like `serialize`)
      
      ```
      Calculating -------------------------------------
       #changed? with serialized column (before)
                             391.000  i/100ms
       #changed? with serialized column (after)
                               1.514k i/100ms
      -------------------------------------------------
       #changed? with serialized column (before)
                                4.243k (± 3.7%) i/s -     21.505k
       #changed? with serialized column (after)
                               16.789k (± 3.2%) i/s -     84.784k
      ```
      be9b6803
  4. 19 1月, 2015 2 次提交
  5. 18 1月, 2015 1 次提交
  6. 17 1月, 2015 1 次提交
  7. 16 1月, 2015 1 次提交
  8. 15 1月, 2015 1 次提交
  9. 11 1月, 2015 2 次提交
    • S
      Stop special casing null binary data in logging · 7a09fc55
      Sean Griffin 提交于
      There's very little value in logging "<NULL binary data>" instead of
      just "nil". I'd like to remove the column from the equation entirely,
      and this case is preventing us from doing so.
      7a09fc55
    • S
      Don't attempt to save dirty attributes which are not persistable · 4d5e6607
      Sean Griffin 提交于
      This sets a precident for how we handle `attribute` calls, which aren't
      backed by a database column. We should not take this as a conscious
      decision on how to handle them, and this can change when we make
      `attribute` public if we have better ideas in the future.
      
      As the composed attributes API gets fleshed out, I expect the
      `persistable_attributes` method to change to
      `@attributes.select(&:persistable).keys`, or some more performant
      variant there-of. This can probably go away completely once we fully
      move dirty checking into the attribute objects once it gets moved up to
      Active Model.
      
      Fixes #18407
      4d5e6607
  10. 10 1月, 2015 2 次提交
  11. 06 1月, 2015 2 次提交
  12. 05 1月, 2015 6 次提交
  13. 04 1月, 2015 12 次提交
  14. 03 1月, 2015 2 次提交
    • C
      Add config to halt callback chain on return false · 9c65c539
      claudiob 提交于
      This stems from [a comment](rails#17227 (comment)) by @dhh.
      In summary:
      
      * New Rails 5.0 apps will not accept `return false` as a way to halt callback chains, and will not display a deprecation warning.
      * Existing apps ported to Rails 5.0 will still accept `return false` as a way to halt callback chains, albeit with a deprecation warning.
      
      For this purpose, this commit introduces a Rails configuration option:
      
      ```ruby
      config.active_support.halt_callback_chains_on_return_false
      ```
      
      For new Rails 5.0 apps, this option will be set to `false` by a new initializer
      `config/initializers/callback_terminator.rb`:
      
      ```ruby
      Rails.application.config.active_support.halt_callback_chains_on_return_false = false
      ```
      
      For existing apps ported to Rails 5.0, the initializers above will not exist.
      Even running `rake rails:update` will not create this initializer.
      
      Since the default value of `halt_callback_chains_on_return_false` is set to
      `true`, these apps will still accept `return true` as a way to halt callback
      chains, displaying a deprecation warning.
      
      Developers will be able to switch to the new behavior (and stop the warning)
      by manually adding the line above to their `config/application.rb`.
      
      A gist with the suggested release notes to add to Rails 5.0 after this
      commit is available at https://gist.github.com/claudiob/614c59409fb7d11f2931
      9c65c539
    • C
      Deprecate `false` as the way to halt AR callbacks · bb78af73
      claudiob 提交于
      Before this commit, returning `false` in an ActiveRecord `before_` callback
      such as `before_create` would halt the callback chain.
      
      After this commit, the behavior is deprecated: will still work until
      the next release of Rails but will also display a deprecation warning.
      
      The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
      bb78af73
  15. 02 1月, 2015 2 次提交
  16. 31 12月, 2014 2 次提交