1. 21 7月, 2015 1 次提交
    • R
      Deprecate and rename the keys for association restrict_dependent_destroy · b184398b
      Roque Pinel 提交于
      Previously `has_one` and `has_many` associations were using the
      `one` and `many` keys respectively. Both of these keys have special
      meaning in I18n (they are considered to be pluralizations) so by
      renaming them to `has_one` and `has_many` we make the messages more
      explicit and most importantly they don't clash with linguistical
      systems that need to validate translation keys (and their
      pluralizations).
      
      The `:'restrict_dependent_destroy.one'` key should be replaced with
      `:'restrict_dependent_destroy.has_one'`, and
      `:'restrict_dependent_destroy.many'` with
      `:'restrict_dependent_destroy.has_many'`.
      
      [Roque Pinel & Christopher Dell]
      b184398b
  2. 17 7月, 2015 1 次提交
    • P
      Silence deprecation warning from force reload · b5b89796
      Prem Sichanugrist 提交于
      We deprecate the support for passing an argument to force reload in
      6eae366d. That led to several
      deprecation warning when running Active Record test suite.
      
      This commit silence the warnings by properly calling `#reload` on the
      association proxy or on the association object instead. However, there
      are several places that `ActiveSupport::Deprecation.silence` are used as
      those tests actually tests the force reload functionality and will be
      removed once `master` is targeted next minor release (5.1).
      b5b89796
  3. 16 7月, 2015 1 次提交
    • P
      Deprecate force association reload by passing true · 6eae366d
      Prem Sichanugrist 提交于
      This is to simplify the association API, as you can call `reload` on the
      association proxy or the parent object to get the same result.
      
      For collection association, you can call `#reload` on association proxy
      to force a reload:
      
          @user.posts.reload   # Instead of @user.posts(true)
      
      For singular association, you can call `#reload` on the parent object to
      clear its association cache then call the association method:
      
          @user.reload.profile   # Instead of @user.profile(true)
      
      Passing a truthy argument to force association to reload will be removed
      in Rails 5.1.
      6eae366d
  4. 01 7月, 2015 1 次提交
    • S
      Correct through associations using scopes · bc6ac860
      Sean Griffin 提交于
      The changes introduced to through associations in c80487eb were quite
      interesting. Changing `relation.merge!(scope)` to `relation =
      relation.merge(scope)` should in theory never cause any changes in
      behavior. The subtle breakage led to a surprising conclusion.
      
      The old code wasn't doing anything! Since `merge!` calls
      `instance_exec` when given a proc, and most scopes will look something
      like `has_many :foos, -> { where(foo: :bar) }`, if we're not capturing
      the return value, it's a no-op. However, removing the `merge` causes
      `unscope` to break.
      
      While we're merging in the rest of the chain elsewhere, we were never
      merging in `unscope` values, causing a breakage on associations where a
      default scope was being unscoped in an association scope (yuk!). This is
      subtly related to #20722, since it appears we were previously relying on
      this mutability.
      
      Fixes #20721.
      Fixes #20727.
      bc6ac860
  5. 22 6月, 2015 1 次提交
  6. 17 6月, 2015 1 次提交
  7. 14 6月, 2015 1 次提交
  8. 26 5月, 2015 2 次提交
  9. 08 5月, 2015 1 次提交
    • Y
      remove duplicate test. · f1da919a
      Yves Senn 提交于
      The old `test_create_bang_returns_falsy_when_join_record_has_errors` had
      a missleading name and was a duplicate of
      `test_save_should_not_raise_exception_when_join_record_has_errors`.
      
      Since it had an assertion on the return value I renamed it accordingly
      and got rid of the duplicate test.
      f1da919a
  10. 02 5月, 2015 1 次提交
  11. 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
  12. 09 4月, 2015 1 次提交
    • A
      Batch touch parent records · 89713897
      Arthur Neves 提交于
      [fixes #18606]
      
      Make belongs_to use touch over touch_later when running the callbacks.
      
      Add more tests and small method rename
      
      Thanks Jeremy for the feedback.
      89713897
  13. 04 4月, 2015 1 次提交
  14. 01 4月, 2015 1 次提交
  15. 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
  16. 16 3月, 2015 1 次提交
  17. 06 3月, 2015 2 次提交
    • Y
      Revert ":cut: remove unnecessary rescue Exceptions" · a068aa3e
      Yves Senn 提交于
      This reverts commit ff18049c.
      
      This broke the AR build for every adapter:
      
            1) Error:
          AssociationCallbacksTest#test_dont_add_if_before_callback_raises_exception:
          Exception: You can't add a post
      
            2) Failure:
          QueryCacheTest#test_query_cache_doesnt_leak_cached_results_of_rolled_back_queries [/Users/senny/Projects/rails/activerecord/test/cases/query_cache_test.rb:235]:
          Expected: 1
            Actual: 0
      
      I'm reverting to get the build green again.
      a068aa3e
    • A
      :cut: remove unnecessary rescue Exceptions · ff18049c
      Aaron Patterson 提交于
      ff18049c
  18. 28 2月, 2015 1 次提交
  19. 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
  20. 26 2月, 2015 1 次提交
    • R
      Follow-up to #10776 · 95c2fc96
      Robin Dupret 提交于
      The name `ActiveModel::AttributeAssignment::UnknownAttributeError` is
      too implementation specific so let's move the constant directly under
      the ActiveModel namespace.
      
      Also since this constant used to be under the ActiveRecord namespace, to
      make the upgrade path easier, let's avoid raising the former constant
      when we deal with this error on the Active Record side.
      95c2fc96
  21. 22 2月, 2015 1 次提交
  22. 21 2月, 2015 1 次提交
  23. 13 2月, 2015 1 次提交
  24. 28 1月, 2015 3 次提交
    • H
      Provide a better error message on :required association · 9a6c6c6f
      Henrik Nygren 提交于
      Fixes #18696.
      9a6c6c6f
    • S
      Use an `Attribute` object to represent a bind value · 6c235dd9
      Sean Griffin 提交于
      The column is primarily used for type casting, which we're trying to
      separate from the idea of a column. Since what we really need is the
      combination of a name, type, and value, let's use the object that we
      already have to represent that concept, rather than this tuple. No
      consumers of the bind values have been changed, only the producers
      (outside of tests which care too much about internals). This is
      *finally* possible since the bind values are now produced from a
      reasonable number of lcoations.
      6c235dd9
    • S
      `WhereClause#predicates` does not need to be public · d26dd008
      Sean Griffin 提交于
      The only place it was accessed was in tests. Many of them have another
      way that they can test their behavior, that doesn't involve reaching
      into internals as far as they did. `AssociationScopeTest` is testing a
      situation where the where clause would have one bind param per
      predicate, so it can just ignore the predicates entirely. The where
      chain test was primarly duplicating the logic tested on `WhereClause`
      directly, so I instead just make sure it calls the appropriate method
      which is fully tested in isolation.
      d26dd008
  25. 27 1月, 2015 1 次提交
  26. 26 1月, 2015 1 次提交
  27. 24 1月, 2015 1 次提交
  28. 20 1月, 2015 1 次提交
  29. 16 1月, 2015 1 次提交
  30. 05 1月, 2015 1 次提交
  31. 04 1月, 2015 2 次提交
  32. 02 1月, 2015 1 次提交
  33. 31 12月, 2014 3 次提交