Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8554

Show
Ignore:
Timestamp:
01/04/08 03:19:50 (3 years ago)
Author:
bitsweat
Message:

pdate_all ignores scoped :order and :limit, so post.comments.update_all doesn't try to include the comment order in the update statement. Closes #10686.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r8546 r8554  
    11*SVN* 
     2 
     3* update_all ignores scoped :order and :limit, so post.comments.update_all doesn't try to include the comment order in the update statement.  #10686 [Brendan Ribera] 
    24 
    35* Added ActiveRecord::Base.cache_key to make it easier to cache Active Records in combination with the new ActiveSupport::Cache::* libraries [DHH] 
  • trunk/activerecord/lib/active_record/base.rb

    r8546 r8554  
    681681        scope = scope(:find) 
    682682        add_conditions!(sql, conditions, scope) 
    683         add_order!(sql, options[:order], scope
    684         add_limit!(sql, options, scope
     683        add_order!(sql, options[:order], nil
     684        add_limit!(sql, options, nil
    685685        connection.update(sql, "#{name} Update") 
    686686      end 
  • trunk/activerecord/test/base_test.rb

    r8553 r8554  
    597597  end 
    598598 
     599  def test_update_all_ignores_order_limit_from_association 
     600    author = Author.find(1) 
     601    assert_nothing_raised do 
     602      assert_equal author.posts_with_comments_and_categories.length, author.posts_with_comments_and_categories.update_all("body = 'bulk update!'") 
     603    end 
     604  end 
     605 
    599606  def test_update_many 
    600607    topic_data = { 1 => { "content" => "1 updated" }, 2 => { "content" => "2 updated" } }