You are here: Home > Latest news from Darcs > Imports changes from Rails' revision r9019

Revision 20080314153420-9043f-2feb39...

Imports changes from Rails' revision r9019

vendor/rails/activerecord/CHANGELOG
vendor/rails/activerecord/lib/active_record/calculations.rb
vendor/rails/activerecord/test/associations/join_model_test.rb

Changes to CHANGELOG

1
*SVN*
*SVN*
1
2
2
 
* Ensure that ActiveRecord::Calculations disambiguates field names with the table name.  #11027 [cavalle]
3
 
4
3
* Ensure that modifying has_and_belongs_to_many actions clear the query cache.  Closes #10840 [john.andrews]
* Ensure that modifying has_and_belongs_to_many actions clear the query cache.  Closes #10840 [john.andrews]
5
4
6
5
* Fix issue where Table#references doesn't pass a :null option to a *_type attribute for polymorphic associations.  Closes #10753 [railsjitsu]
* Fix issue where Table#references doesn't pass a :null option to a *_type attribute for polymorphic associations.  Closes #10753 [railsjitsu]
7

Changes to calculations.rb

155
          scope           = scope(:find)
          scope           = scope(:find)
155
156
          merged_includes = merge_includes(scope ? scope[:include] : [], options[:include])
          merged_includes = merge_includes(scope ? scope[:include] : [], options[:include])
156
157
          aggregate_alias = column_alias_for(operation, column_name)
          aggregate_alias = column_alias_for(operation, column_name)
157
 
          column_name     = "#{connection.quote_table_name(table_name)}.#{column_name}" unless column_name == "*" || column_name.to_s.include?('.')
158
158
159
159
          if operation == 'count'
          if operation == 'count'
160
160
            if merged_includes.any?
            if merged_includes.any?
161

Changes to join_model_test.rb

536
    assert_nothing_raised { authors(:david).comments.sum(:post_id) }
    assert_nothing_raised { authors(:david).comments.sum(:post_id) }
536
537
  end
  end
537
538
538
 
  def test_calculations_on_has_many_through_should_disambiguate_fields
539
 
    assert_nothing_raised { authors(:david).categories.maximum(:id) }
540
 
  end
541
 
  
542
 
  def test_calculations_on_has_many_through_should_not_disambiguate_fields_unless_necessary
543
 
    assert_nothing_raised { authors(:david).categories.maximum("categories.id") }
544
 
  end
545
 
546
539
  def test_has_many_through_has_many_with_sti
  def test_has_many_through_has_many_with_sti
547
540
    assert_equal [comments(:does_it_hurt)], authors(:david).special_post_comments
    assert_equal [comments(:does_it_hurt)], authors(:david).special_post_comments
548
541
  end
  end
549