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

Changeset 7133

Show
Ignore:
Timestamp:
06/27/07 02:56:11 (1 year ago)
Author:
bitsweat
Message:

Array attribute conditions work with proxied association collections. Closes #8318.

Files:

Legend:

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

    r7119 r7133  
    11*SVN* 
     2 
     3* Array attribute conditions work with proxied association collections.  #8318 [kamal, theamazingrando] 
    24 
    35* Fix polymorphic has_one associations declared in an abstract class.  #8638 [lifofifo, daxhuiberts] 
  • trunk/activerecord/lib/active_record/base.rb

    r7107 r7133  
    12881288          case argument 
    12891289            when nil   then "IS ?" 
    1290             when Array then "IN (?)" 
     1290            when Array, ActiveRecord::Associations::AssociationCollection then "IN (?)" 
    12911291            when Range then "BETWEEN ? AND ?" 
    12921292            else            "= ?" 
  • trunk/activerecord/test/finder_test.rb

    r6998 r7133  
    99 
    1010class FinderTest < Test::Unit::TestCase 
    11   fixtures :companies, :topics, :entrants, :developers, :developers_projects, :posts, :comments, :accounts 
     11  fixtures :companies, :topics, :entrants, :developers, :developers_projects, :posts, :comments, :accounts, :authors 
    1212 
    1313  def test_find 
     
    158158    assert Topic.find(1, :conditions => { :approved => false }) 
    159159    assert_raises(ActiveRecord::RecordNotFound) { Topic.find(1, :conditions => { :approved => true }) } 
     160  end 
     161 
     162  def test_find_on_association_proxy_conditions 
     163    assert_equal [1, 2, 3, 5, 6, 7, 8, 9, 10], Comment.find_all_by_post_id(authors(:david).posts).map(&:id).sort 
    160164  end 
    161165