1. 20 2月, 2015 2 次提交
  2. 19 2月, 2015 2 次提交
  3. 18 2月, 2015 2 次提交
  4. 17 2月, 2015 1 次提交
  5. 13 2月, 2015 3 次提交
  6. 12 2月, 2015 3 次提交
    • R
      Allow `:precision` option for time type columns · 1502caef
      Ryuta Kamizono 提交于
      1502caef
    • S
      Refactor enum to be defined in terms of the attributes API · c51f9b61
      Sean Griffin 提交于
      In addition to cleaning up the implementation, this allows type casting
      behavior to be applied consistently everywhere. (#where for example). A
      good example of this was the previous need for handling value to key
      conversion in the setter, because the number had to be passed to `where`
      directly. This is no longer required, since we can just pass the string
      along to where. (It's left around for backwards compat)
      
      Fixes #18387
      c51f9b61
    • S
      `current_scope` shouldn't pollute sibling STI classes · 5e0b555b
      Sean Griffin 提交于
      It looks like the only reason `current_scope` was thread local on
      `base_class` instead of `self` is to ensure that when we call a named
      scope created with a proc on the parent class, it correctly uses the
      default scope of the subclass. The reason this wasn't happening was
      because the proc captured `self` as the parent class, and we're not
      actually defining a real method. Using `instance_exec` fixes the
      problem.
      
      Fixes #18806
      5e0b555b
  7. 11 2月, 2015 2 次提交
  8. 09 2月, 2015 1 次提交
  9. 08 2月, 2015 2 次提交
  10. 07 2月, 2015 1 次提交
  11. 04 2月, 2015 2 次提交
    • S
      Respect custom primary keys for associations in `Relation#where` · cd0ed12d
      Sean Griffin 提交于
      While we query the proper columns, we go through normal handling for
      converting the value to a primitive which assumes it should use the
      table's primary key. If the association specifies a different value (and
      we know that we're working with an association), we should use the
      custom primary key instead.
      
      Fixes #18813.
      cd0ed12d
    • S
      Correct errors in counter cache updating · 23bb8d77
      Sean Griffin 提交于
      The cache name should be converted to a string when given, not compared
      as a symbol. This edge case is already adequately covered by our tests,
      but was masked by another issue where we were incorrectly updating the
      counter cache twice. When paired with a bug where we didn't update the
      counter cache because we couldn't find a match with the name, this made
      it look like everything was working fine.
      
      Fixes #10865.
      23bb8d77
  12. 03 2月, 2015 1 次提交
  13. 02 2月, 2015 1 次提交
    • E
      Fix validations on child record when record parent has validate: false · 27aa4dda
      eileencodes 提交于
      Fixes #17621. This 5 year old (or older) issue causes validations to fire
      when a parent record has `validate: false` option and a child record is
      saved. It's not the responsibility of the model to validate an
      associated object unless the object was created or modified by the
      parent.
      
      Clean up tests related to validations
      
      `assert_nothing_raised` is not benefiting us in these tests
      Corrected spelling of "respects"
      It's better to use `assert_not_operator` over `assert !r.valid`
      27aa4dda
  14. 01 2月, 2015 1 次提交
  15. 31 1月, 2015 1 次提交
  16. 29 1月, 2015 3 次提交
  17. 24 1月, 2015 3 次提交
  18. 22 1月, 2015 1 次提交
  19. 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
  20. 19 1月, 2015 2 次提交
  21. 18 1月, 2015 1 次提交
  22. 17 1月, 2015 1 次提交
  23. 16 1月, 2015 1 次提交
  24. 15 1月, 2015 1 次提交
  25. 11 1月, 2015 1 次提交