public function test_gh93_and_gh100_eager_loading_respects_association_options() { Venue::$has_many = array(array('events', 'class_name' => 'Event', 'order' => 'id asc', 'conditions' => array('length(title) = ?', 14))); $venues = Venue::find(array(2, 6), array('include' => 'events')); $this->assert_sql_has("WHERE length(title) = ? AND venue_id IN(?,?) ORDER BY id asc", ActiveRecord\Table::load('Event')->last_sql); $this->assert_equals(1, count($venues[0]->events)); }
public function test_has_one_through() { Venue::$has_many = array(array('events'), array('hosts', 'through' => 'events')); $venue = Venue::first(); $this->assert_true(count($venue->hosts) > 0); }