1. 29 6月, 2017 1 次提交
  2. 28 5月, 2017 1 次提交
    • R
      Fix association with extension issues · 9b78974b
      Ryuta Kamizono 提交于
      This fixes the following issues.
      
      * `association_scope` doesn't include `default_scope`. Should use `scope` instead.
      * We can't use `method_missing` for customizing existing method.
      * We can't use `relation_delegate_class` for sharing extensions. Should extend per association.
      9b78974b
  3. 20 3月, 2017 1 次提交
  4. 29 10月, 2016 1 次提交
  5. 16 8月, 2016 1 次提交
  6. 07 8月, 2016 2 次提交
  7. 30 7月, 2016 1 次提交
  8. 12 1月, 2016 1 次提交
    • M
      Skip the STI condition when evaluating a default scope · 5c6d3653
      Matthew Draper 提交于
      Given a default_scope on a parent of the current class, where that
      parent is not the base class, the parent's STI condition would become
      attached to the evaluated default scope, and then override the child's
      own STI condition.
      
      Instead, we can treat the STI condition as though it is a default scope,
      and skip it in this situation: the scope will be merged into the base
      relation, which already contains the correct STI condition.
      
      Fixes #22426.
      5c6d3653
  9. 21 10月, 2015 1 次提交
  10. 08 7月, 2015 1 次提交
    • R
      Fix regression caused by a01d164b · 1b4399df
      Rafael Mendonça França 提交于
      When preload is used in a default scope the preload_values were
      returning nested arrays and causing the preloader to fail because it
      doesn't know how to deal with nested arrays. So before calling preload!
      we need to splat the arguments.
      
      This is not needed to includes because it flatten its arguments.
      1b4399df
  11. 07 4月, 2015 1 次提交
    • T
      Require explicit counter_cache option for has_many · e0cb21f5
      Tristan Gamilis 提交于
      Previously has_many associations assumed a counter_cache was to be used
      based on the presence of an appropriately named column. This is
      inconsistent, since the inverse belongs_to association will not make
      this assumption. See issues #19042 #8446.
      This commit checks for the presence of the counter_cache key in the
      options of either the has_many or belongs_to association as well as
      ensuring that the *_count column is present.
      e0cb21f5
  12. 25 3月, 2015 1 次提交
    • C
      DRY up STI subclass logic · 7c0f8c64
      Cody Cutrer 提交于
      the newer method used for discriminating new records did not
      use the older and more robust method used for instantiating
      existing records, but did have a better post-check to ensure
      the sublass was in the hierarchy. so move the descendants check
      to find_sti_class, and then simply call find_sti_class from
      subclass_from_attributes
      
      now with fixed specs
      7c0f8c64
  13. 29 1月, 2015 1 次提交
  14. 05 1月, 2015 1 次提交
  15. 09 12月, 2014 1 次提交
  16. 03 12月, 2014 1 次提交
  17. 21 11月, 2014 1 次提交
  18. 02 11月, 2014 1 次提交
    • S
      Use bind values for joined tables in where statements · 10f75af9
      Sean Griffin 提交于
      In practical terms, this allows serialized columns and tz aware columns
      to be used in wheres that go through joins, where they previously would
      not behave correctly. Internally, this removes 1/3 of the cases where we
      rely on Arel to perform type casting for us.
      
      There were two non-obvious changes required for this. `update_all` on
      relation was merging its bind values with arel's in the wrong order.
      Additionally, through associations were assuming there would be no bind
      parameters in the preloader (presumably because the where would always
      be part of a join)
      
      [Melanie Gilman & Sean Griffin]
      10f75af9
  19. 13 10月, 2014 1 次提交
    • A
      Autosave callbacks shouldn't be `after_save` · 719d52db
      Agis- 提交于
      068f092c registered autosave callbacks
      as `after_save` callbacks. This caused the regression described in #17209.
      
      Autosave callbacks should be registered as `after_update` and
      `after_create` callbacks, just like before.
      
      This is a partial revert of 068f092c.
      
      Fixes #17209.
      719d52db
  20. 04 9月, 2014 1 次提交
    • S
      Skip StatementCache for eager loaded associations (Fixes #16761) · 4abbdbdf
      Sammy Larbi 提交于
      Eagerly loaded collection and singular associations are ignored by the StatementCache, which causes errors when the queries they generate reference columns that were not eagerly loaded.
      
      This commit skips the creation of the StatementCache as a fix for these scenarios.
      4abbdbdf
  21. 19 8月, 2014 1 次提交
  22. 26 6月, 2014 1 次提交
    • S
      Deprecate automatic counter caches on has_many :through · d730e374
      Sean Griffin 提交于
      Reliant on https://github.com/rails/rails/pull/15747 but pulled to a
      separate PR to reduce noise. `has_many :through` associations have the
      undocumented behavior of automatically detecting counter caches.
      However, the way in which it does so is inconsistent with counter caches
      everywhere else, and doesn't actually work consistently.
      
      As with normal `has_many` associations, the user should specify the
      counter cache on the `belongs_to`, if they'd like it updated.
      d730e374
  23. 15 5月, 2014 1 次提交
    • N
      Make filter_binds filter out symbols that are equal to strings · 1d316ac1
      Nat Budin 提交于
      ActiveRecord::Relation::Merger's filter_binds method does not filter out bind
      variables when one of the attribute nodes has a string name, but the other has
      a symbol name, even when those names are actually equal.
      
      This can result in there being more bind variables than placeholders in the
      generated SQL.  This is particularly an issue for PostgreSQL, where this is
      treated as an error.
      
      This patch changes the filter_binds method to make it convert both attribute
      names to strings before comparing.
      1d316ac1
  24. 05 5月, 2014 1 次提交
  25. 12 4月, 2014 1 次提交
  26. 03 4月, 2014 2 次提交
  27. 28 10月, 2013 1 次提交
  28. 11 9月, 2013 1 次提交
  29. 30 8月, 2013 1 次提交
  30. 18 8月, 2013 1 次提交
  31. 25 7月, 2013 1 次提交
  32. 27 1月, 2013 1 次提交
    • D
      Fix cases where delete_records on a has_many association caused errors · 0a71c7b8
      Derek Kraan 提交于
      because of an ambiguous column name. This happened if the association
      model had a default scope that referenced a third table, and the third
      table also referenced the original table (with an identical
      foreign_key).
      
      Mysql requires that ambiguous columns are deambiguated by using the full
      table.column syntax. Postgresql and Sqlite use a different syntax for
      updates altogether (and don't tolerate table.name syntax), so the fix
      requires always including the full table.column and discarding it later
      for Sqlite and Postgresql.
      0a71c7b8
  33. 24 1月, 2013 3 次提交
  34. 20 1月, 2013 1 次提交
  35. 18 1月, 2013 1 次提交
    • J
      Undeprecate the :extend option · 5937bd02
      Jon Leighton 提交于
      Suggested by @dhh.
      
      It doesn't affect the generated SQL, so seems reasonable to continue to
      allow it as an association option.
      5937bd02
  36. 22 9月, 2012 1 次提交