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

Changeset 9019

Show
Ignore:
Timestamp:
03/13/08 03:12:23 (4 months ago)
Author:
rick
Message:

port [9018] to 2.0 stable

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2-0-stable/activerecord/CHANGELOG

    r8947 r9019  
    11*SVN* 
     2 
     3* Ensure that ActiveRecord::Calculations disambiguates field names with the table name.  #11027 [cavalle] 
    24 
    35* Ensure that modifying has_and_belongs_to_many actions clear the query cache.  Closes #10840 [john.andrews] 
  • branches/2-0-stable/activerecord/lib/active_record/calculations.rb

    r8779 r9019  
    156156          merged_includes = merge_includes(scope ? scope[:include] : [], options[:include]) 
    157157          aggregate_alias = column_alias_for(operation, column_name) 
     158          column_name     = "#{connection.quote_table_name(table_name)}.#{column_name}" unless column_name == "*" || column_name.to_s.include?('.') 
    158159 
    159160          if operation == 'count' 
  • branches/2-0-stable/activerecord/test/associations/join_model_test.rb

    r8481 r9019  
    537537  end 
    538538 
     539  def test_calculations_on_has_many_through_should_disambiguate_fields 
     540    assert_nothing_raised { authors(:david).categories.maximum(:id) } 
     541  end 
     542   
     543  def test_calculations_on_has_many_through_should_not_disambiguate_fields_unless_necessary 
     544    assert_nothing_raised { authors(:david).categories.maximum("categories.id") } 
     545  end 
     546 
    539547  def test_has_many_through_has_many_with_sti 
    540548    assert_equal [comments(:does_it_hurt)], authors(:david).special_post_comments