1. 17 3月, 2015 1 次提交
    • B
      Closes rails/rails#18864: Renaming transactional fixtures to transactional tests · 09658635
      Brandon Weiss 提交于
      I’m renaming all instances of `use_transcational_fixtures` to
      `use_transactional_tests` and “transactional fixtures” to
      “transactional tests”.
      
      I’m deprecating `use_transactional_fixtures=`. So anyone who is
      explicitly setting this will get a warning telling them to use
      `use_transactional_tests=` instead.
      
      I’m maintaining backwards compatibility—both forms will work.
      `use_transactional_tests` will check to see if
      `use_transactional_fixtures` is set and use that, otherwise it will use
      itself. But because `use_transactional_tests` is a class attribute
      (created with `class_attribute`) this requires a little bit of hoop
      jumping. The writer method that `class_attribute` generates defines a
      new reader method that return the value being set. Which means we can’t
      set the default of `true` using `use_transactional_tests=` as was done
      previously because that won’t take into account anyone using
      `use_transactional_fixtures`. Instead I defined the reader method
      manually and it checks `use_transactional_fixtures`. If it was set then
      it should be used, otherwise it should return the default, which is
      `true`. If someone uses `use_transactional_tests=` then it will
      overwrite the backwards-compatible method with whatever they set.
      09658635
  2. 12 3月, 2015 1 次提交
  3. 04 3月, 2015 2 次提交
  4. 28 2月, 2015 1 次提交
  5. 27 2月, 2015 1 次提交
    • S
      Properly create through records when called with `where` · 38218929
      Sean Griffin 提交于
      Various behaviors needed by associations (such as creating the through
      record) are lost when `where` is called, since we stop having a
      `CollectionProxy` and start having an `AssociationRelation` which does
      not contain this behavior. I *think* we should be able to rm
      `AssociationRelation`, but we have tests saying the changes required to
      do that would be bad (Without saying why. Of course. >_>)
      
      Fixes #19073.
      38218929
  6. 26 2月, 2015 1 次提交
    • R
      Add `SchemaMigration.create_table` support any unicode charsets for MySQL. · 3239b6a9
      Ryuta Kamizono 提交于
      MySQL unicode support is not only `utf8mb4`.
      Then, The index length problem is not only `utf8mb4`.
      
      http://dev.mysql.com/doc/refman/5.6/en/charset-unicode.html
      
          SELECT * FROM information_schema.character_sets WHERE maxlen > 3;
          +--------------------+----------------------+------------------+--------+
          | CHARACTER_SET_NAME | DEFAULT_COLLATE_NAME | DESCRIPTION      | MAXLEN |
          +--------------------+----------------------+------------------+--------+
          | utf8mb4            | utf8mb4_general_ci   | UTF-8 Unicode    |      4 |
          | utf16              | utf16_general_ci     | UTF-16 Unicode   |      4 |
          | utf16le            | utf16le_general_ci   | UTF-16LE Unicode |      4 |
          | utf32              | utf32_general_ci     | UTF-32 Unicode   |      4 |
          +--------------------+----------------------+------------------+--------+
      3239b6a9
  7. 25 2月, 2015 1 次提交
    • Y
      rework `disable_referential_integrity` for PostgreSQL. · 72c15572
      Yves Senn 提交于
      [Toby Ovod-Everett & Andrey Nering & Yves Senn]
      
      Closes #17726.
      Closes #10939.
      
      This patch makes three distinct modifications:
      
      1. no longer fall back to disabling user triggers if system triggers can't be disabled
      2. warn the user when referential integrity can't be disabled
      3. restore aborted transactions when referential integrity can't be disabled
      
      The motivation behind these changes is to make the behavior of Rails
      transparent and less error-prone. To require superuser privileges is not optimal
      but it's what Rails currently needs. Users who absolutely rely on disabling user triggers
      can patch `disable_referential_integrity`.
      
      We should investigate `SET CONSTRAINTS` as a possible solution which does not require
      superuser privileges.
      
      /cc @matthewd
      72c15572
  8. 24 2月, 2015 1 次提交
  9. 23 2月, 2015 1 次提交
  10. 22 2月, 2015 1 次提交
  11. 20 2月, 2015 2 次提交
  12. 19 2月, 2015 2 次提交
  13. 18 2月, 2015 2 次提交
  14. 17 2月, 2015 1 次提交
  15. 13 2月, 2015 3 次提交
  16. 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
  17. 11 2月, 2015 2 次提交
  18. 09 2月, 2015 1 次提交
  19. 08 2月, 2015 2 次提交
  20. 07 2月, 2015 1 次提交
  21. 04 2月, 2015 3 次提交
    • 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
    • M
      Always reset changed attributes in becomes · 5f6370a8
      Miklos Fazekas 提交于
      When ```becomes``` changes @attributes it should also change
      @changed_attributes. Otherwise we'll experience a kind of split head situation
      where attributes are coming from ```self```, but changed_attributes is coming
      from ```klass.new```. This affects the inheritance_colmn as it's changed by new
      for example.
      
      Fixes #16881
      5f6370a8
    • 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
  22. 03 2月, 2015 1 次提交
  23. 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
  24. 01 2月, 2015 1 次提交
  25. 31 1月, 2015 1 次提交
  26. 29 1月, 2015 3 次提交