1. 24 6月, 2013 1 次提交
  2. 22 6月, 2013 1 次提交
  3. 18 6月, 2013 1 次提交
  4. 01 6月, 2013 1 次提交
  5. 23 5月, 2013 1 次提交
    • Y
      Fix the `:primary_key` option for `has_many` associations. · ef99c114
      Yves Senn 提交于
      When removing records from a `has_many` association it used
      the `primary_key` defined on the association.
      
      Our test suite didn't fail because on all occurences of `:primary_key`,
      the specified column was available in both tables. This prevented the
      code from raising an exception but it still behaved badly.
      
      I added a test-case to prevent regressions that failed with:
      
      ```
        1) Error:
      HasManyAssociationsTest#test_has_many_assignment_with_custom_primary_key:
      ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: essays.first_name: UPDATE "essays" SET "writer_id" = NULL WHERE "essays"."writer_id" = ? AND "essays"."first_name" IS NULL
      ```
      ef99c114
  6. 22 4月, 2013 1 次提交
    • M
      Update counter cache when pushing into association · 1e27f1c5
      Matthew Robertson 提交于
      This commit fixes a regression bug in which counter_cache columns
      were not being updated correctly when newly created records were
      being pushed into an assocation. EG:
      
          # this was fine
          @post.comment.create!
      
          # this was fine
          @comment = Comment.first
          @post.comments << @comment
      
          # this would not update counters
          @post.comments << Comment.create!
      1e27f1c5
  7. 16 3月, 2013 1 次提交
  8. 25 2月, 2013 1 次提交
  9. 24 2月, 2013 1 次提交
  10. 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
  11. 18 1月, 2013 4 次提交
  12. 13 1月, 2013 1 次提交
  13. 07 12月, 2012 2 次提交
  14. 30 11月, 2012 1 次提交
  15. 29 11月, 2012 2 次提交
  16. 26 11月, 2012 1 次提交
  17. 22 11月, 2012 2 次提交
  18. 17 11月, 2012 1 次提交
  19. 12 11月, 2012 1 次提交
  20. 09 11月, 2012 3 次提交
  21. 05 11月, 2012 1 次提交
  22. 04 10月, 2012 1 次提交
    • F
      Count returns 0 without querying if parent is not saved · aa202adf
      Francesco Rodriguez 提交于
      Patches `CollectionAssociation#count` to return 0 without querying
      if the parent record is new. Consider the following code:
      
          class Account
            has_many :dossiers
          end
      
          class Dossier
            belongs_to :account
          end
      
          a = Account.new
          a.dossiers.build
      
          # before patch
          a.dossiers.count
          # SELECT COUNT(*) FROM "dossiers" WHERE "dossiers"."account_id" IS NULL
          # => 0
      
          # after
          a.dosiers.count # fires without sql query
          # => 0
      
      Fixes #1856.
      aa202adf
  23. 17 9月, 2012 4 次提交
  24. 11 8月, 2012 1 次提交
    • J
      Remove the dependent_restrict_raises option. · 5ad79989
      Jon Leighton 提交于
      It's not really a good idea to have this as a global config option. We
      should allow people to specify the behaviour per association.
      
      There will now be two new values:
      
      * :dependent => :restrict_with_exception implements the current
        behaviour of :restrict. :restrict itself is deprecated in favour of
        :restrict_with_exception.
      * :dependent => :restrict_with_error implements the new behaviour - it
        adds an error to the owner if there are dependent records present
      
      See #4727 for the original discussion of this.
      5ad79989
  25. 03 8月, 2012 1 次提交
    • J
      Remove ActiveRecord::Base.to_a · 55b24888
      Jon Leighton 提交于
      On reflection, it seems like a bit of a weird method to have on
      ActiveRecord::Base, and it shouldn't be needed most of the time anyway.
      55b24888
  26. 02 8月, 2012 2 次提交
  27. 31 7月, 2012 1 次提交
  28. 28 7月, 2012 1 次提交