1. 04 5月, 2015 1 次提交
  2. 03 5月, 2015 2 次提交
  3. 01 5月, 2015 1 次提交
  4. 27 4月, 2015 1 次提交
  5. 22 4月, 2015 1 次提交
  6. 21 4月, 2015 1 次提交
    • A
      Rename association option :class to :anonymous_class · ac2b7a5c
      Andrew White 提交于
      In 1f006c an option was added called :class to allow passing anonymous
      classes to association definitions. Since using :class instead of
      :class_name is a fairly common typo even amongst experienced developers
      this can result in hard to debug errors arising in raise_on_type_mismatch?
      
      To fix this we're renaming the option from :class to :anonymous_class as
      that is a more correct description of what the option is for. Since this
      was an internal, undocumented option there is no need for a deprecation.
      
      Fixes #19659
      ac2b7a5c
  7. 18 4月, 2015 1 次提交
    • S
      Autosave existing records on HMT associations when the parent is new · d849f42b
      Sean Griffin 提交于
      To me it seems like this should only be the case if `autosave: true` is
      set on the association. However, when implemented that way, it caused
      issues with has many associations, where we have explicit tests stating
      that child records are updated when the parent is new, even if autosave
      is not set (presumably to update the parent id, but other changed
      attributes would be persisted as well).
      
      It's quirky, but at least we should be consistently quirky. This
      constitutes a minor but subtle change in behavior, and therefore should
      not be backported to 4.2 and earlier.
      
      Fixes #19782
      d849f42b
  8. 15 4月, 2015 2 次提交
    • P
      Fix missing index when using timestamps with index · c0abeadc
      Paul Mucur 提交于
      The `index` option used with `timestamps` should be passed to both
      `column` definitions for `created_at` and `updated_at` rather than just
      the first.
      
      This was happening because `Hash#delete` is used to extract the `index`
      option passed to `timestamps`, thereby mutating the `options` hash
      in-place. Now take a copy of the `options` before deleting so that the
      original is not modified.
      c0abeadc
    • Y
      Revert "Merge pull request #19755 from yuki24/activerecord/support-for-set" · 5f00ed10
      Yves Senn 提交于
      This reverts commit 524d4059, reversing
      changes made to 34d3a609.
      
      Reasoning behind the revert are in the PR discussion:
      https://github.com/rails/rails/pull/19755
      
      - This means that types can no longer cast to/from `Set`, and reasonably
        work with `where` (we already have this problem for `array`/`json`
        types on pg)
      - This adds precedent for every other `Enumerable`, and we can't target
        `Enumerable` directly.
      - Calling `to_a` on a `Set` is reasonable.
      5f00ed10
  9. 14 4月, 2015 1 次提交
    • Y
      Add support for Set to Relation#where · 50cae600
      Yuki Nishijima 提交于
      Previously `#where` used to treat `Set`objects as nil, but now it treats
      them as an array:
      
        set = Set.new([1, 2])
        Author.where(:id => set)
        # => SELECT "authors".* FROM "authors" WHERE "authors"."id" IN (1, 2)
      50cae600
  10. 13 4月, 2015 1 次提交
  11. 09 4月, 2015 1 次提交
  12. 30 3月, 2015 1 次提交
    • S
      Reduce memory usage when loading types in PG · 445c12f7
      Sean Griffin 提交于
      We were never clearing the `PG::Result` object used to query the types
      when the connection is first established. This would lead to a
      potentially large amount of memory being retained for the life of the
      connection.
      
      Investigating this issue also revealed several low hanging fruit on the
      performance of these methods, and the number of allocations has been
      reduced by ~90%.
      
      Fixes #19578
      445c12f7
  13. 26 3月, 2015 1 次提交
    • J
      Add `config.active_record.warn_on_records_fetched_greater_than` option · 4d6fbe29
      Jason Nochlin 提交于
      When set to an integer, a warning will be logged whenever a result set
      larger than the specified size is returned by a query. Fixes #16463
      
      The warning is outputed a module which is prepended in an initializer,
      so there will be no performance impact if
      `config.active_record.warn_on_records_fetched_greater_than` is not set.
      4d6fbe29
  14. 23 3月, 2015 2 次提交
  15. 22 3月, 2015 2 次提交
  16. 19 3月, 2015 2 次提交
  17. 18 3月, 2015 1 次提交
  18. 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
  19. 16 3月, 2015 1 次提交
  20. 12 3月, 2015 1 次提交
  21. 06 3月, 2015 1 次提交
  22. 04 3月, 2015 2 次提交
  23. 28 2月, 2015 1 次提交
  24. 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
  25. 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
  26. 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
  27. 24 2月, 2015 1 次提交
  28. 23 2月, 2015 1 次提交
  29. 22 2月, 2015 1 次提交
  30. 20 2月, 2015 2 次提交
  31. 19 2月, 2015 2 次提交
  32. 18 2月, 2015 1 次提交
    • H
      Add `time` option to `#touch` · 219d71fb
      Hyonjee Joo 提交于
      Fixes #18905. `#touch` now takes time as an option. Setting the option
      saves the record with the updated_at/on attributes set to the current time
      or the time specified. Updated tests and documentation accordingly.
      219d71fb