1. 10 11月, 2019 2 次提交
  2. 24 4月, 2019 1 次提交
  3. 20 7月, 2017 1 次提交
  4. 02 7月, 2017 1 次提交
  5. 01 7月, 2017 1 次提交
  6. 22 11月, 2016 1 次提交
    • Y
      Introduce `reload_<association>` reader for singular associations. · 0e995713
      Yves Senn 提交于
      This patch brings back the functionality of passing true to the
      association proxy. The behavior was deprecated with #20888 and scheduled
      for removal in Rails 5.1.
      
      The deprecation mentioned that instead of `Article.category(true)` one
      should use `article#reload.category`. Unfortunately the alternative does
      not expose the same behavior as passing true to the reader
      did. Specifically reloading the parent record throws unsaved changes and
      other caches away. Passing true only affected the association.
      
      This is problematic and there is no easy workaround. I propose to bring
      back the old functionality by introducing this new reader method for
      singular associations.
      0e995713
  7. 18 1月, 2016 1 次提交
  8. 13 10月, 2015 1 次提交
  9. 22 2月, 2015 1 次提交
  10. 28 1月, 2015 1 次提交
  11. 02 1月, 2015 1 次提交
  12. 17 7月, 2014 1 次提交
  13. 05 7月, 2014 1 次提交
    • S
      Add a `required` option to singular associations · 00f55516
      Sean Griffin 提交于
      In addition to defining the association, a `required` association will
      also have its presence validated.
      
      Before:
      
      ```ruby
      belongs_to :account
      validates_presence_of :account
      ```
      
      After:
      
      ```ruby
      belongs_to :account, required: true
      ```
      
      This helps to draw a distinction between types of validations, since
      validations on associations are generally for data integrity purposes,
      and aren't usually set through form inputs.
      00f55516
  14. 12 12月, 2013 1 次提交
  15. 11 12月, 2013 1 次提交
  16. 30 11月, 2013 1 次提交
    • G
      Raise `ArgumentError` when `has_one` is used with `counter_cache` · 35fd2d40
      Godfrey Chan 提交于
      Previously, the `has_one` macro incorrectly accepts the `counter_cache` option
      due to a bug, although that options was never supported nor functional on
      `has_one` and `has_one ... through` relationships. It now correctly raises an
      `ArgumentError` when passed that option.
      
      For reference, this bug was introduced in 52f8e4b9.
      35fd2d40
  17. 10 10月, 2013 1 次提交
  18. 09 10月, 2013 4 次提交
  19. 03 10月, 2013 1 次提交
  20. 28 9月, 2013 1 次提交
  21. 02 8月, 2013 1 次提交
  22. 01 8月, 2013 1 次提交
  23. 24 7月, 2013 1 次提交
  24. 09 6月, 2013 1 次提交
  25. 15 5月, 2013 1 次提交
  26. 08 5月, 2013 1 次提交
  27. 11 8月, 2012 2 次提交
    • J
      Use method compilation for association methods · 6e57d5c5
      Jon Leighton 提交于
      Method compilation provides better performance and I think the code
      comes out cleaner as well.
      
      A knock on effect is that methods that get redefined produce warnings. I
      think this is a good thing. I had to deal with a bunch of warnings
      coming from our tests, though.
      6e57d5c5
    • J
      Unprivatise all the things · 825c05d4
      Jon Leighton 提交于
      Well, not all of them, but some of them.
      
      I don't think there's much reason for these methods to be private.
      825c05d4
  28. 14 7月, 2012 1 次提交
  29. 28 11月, 2011 1 次提交
    • J
      avoid warnings · 124c97fb
      Josh Susser 提交于
      This change uses Module.redefine_method as defined in ActiveSupport.
      Making Module.define_method public would be as clean in the code, and
      would also emit warnings when redefining an association. That is pretty
      messy given current tests, so I'm leaving it for someone else to decide
      what approach is better.
      124c97fb
  30. 16 11月, 2011 1 次提交
    • J
      association methods are now generated in modules · 7cba6a37
      Josh Susser 提交于
      Instead of generating association methods directly in the model
      class, they are generated in an anonymous module which
      is then included in the model class. There is one such module
      for each association. The only subtlety is that the
      generated_attributes_methods module (from ActiveModel) must
      be forced to be included before association methods are created
      so that attribute methods will not shadow association methods.
      7cba6a37
  31. 25 5月, 2011 1 次提交
  32. 18 5月, 2011 1 次提交
  33. 11 5月, 2011 1 次提交
  34. 22 2月, 2011 1 次提交