1. 22 2月, 2016 20 次提交
  2. 21 2月, 2016 15 次提交
  3. 20 2月, 2016 5 次提交
    • K
      Make collection caching explicit. · b4558c10
      Kasper Timm Hansen 提交于
      Having collection caching that wraps templates and automatically tries
      to infer if they are cachable proved to be too much of a hassle.
      
      We'd rather have it be something you explicitly turn on.
      
      This removes much of the code and docs to explain the previous automatic
      behavior.
      
      This change also removes scoped cache keys and passing cache_options.
      b4558c10
    • E
      Merge pull request #23793 from qazbnm456/master · eb65f04f
      Eileen M. Uchitelle 提交于
      fix typo
      eb65f04f
    • E
      Always validate record if validating a virtual attribute · 6f15b276
      eileencodes 提交于
      Fixes #23645
      
      When you're using an `attr_accessor` for a record instead of an
      attribute in the database there's no way for the record to know if it
      has `changed?` unless you tell it `attribute_will_change!("attribute")`.
      
      The change made in 27aa4dda updated validations to check if a record was
      `changed?` or `marked_for_destruction?` or not `persisted?`. It did not
      take into account virtual attributes that do not affect the model's
      dirty status.
      
      The only way to fix this is to always validate the record if the
      attribute does not belong to the set of attributes the record expects
      (in `record.attributes`) because virtual attributes will not be in that
      hash.
      
      I think we should consider deprecating this particular behavior in the
      future and requiring that the user mark the record dirty by noting that
      the virtual attribute will change. Unfortunately this isn't easy because
      we have no way of knowing that you did the "right thing" in your
      application by marking it dirty and will get the deprecation warning
      even if you are doing the correct thing.
      
      For now this restores expected behavior when using a virtual attribute
      by always validating the record, as well as adds tests for this case.
      
      I was going to add the `!record.attributes.include?(attribute)` to the
      `should_validate?` method but `uniqueness` cannot validate a virtual
      attribute with nothing to hold on to the attribute. Because of this
      `should_validate?` was about to become a very messy method so I decided
      to split them up so we can handle it specifically for each case.
      6f15b276
    • L
      fix typo · b2d1de26
      Lobsiinvok 提交于
      b2d1de26
    • P