X hits on this document

200 views

0 shares

0 downloads

0 comments

55 / 70

:include hates :select

But :select is ignored with eager loading (:include)!

Animal.find :first,

  :select => 'animals.name, species.name',

  :include => :species,

  :conditions => ['species.name like ?', 'giraffe']

SELECT `animals`.`id` AS t0_r0,

`animals`.`name` AS t0_r1,

`animals`.`email` AS t0_r2,

`animals`.`fav_beer` AS t0_r3,

`animals`.`created_at` AS t0_r4,

`animals`.`updated_at` AS t0_r5,

`animals`.`password` AS t0_r6,

`animals`.`species_id` AS t0_r7,

`species`.`id` AS t1_r0,

`species`.`name` AS t1_r1

FROM `animals` LEFT OUTER JOIN `species` ON

`species`.id = `animals`.species_id

WHERE (species.name like 'giraffe') LIMIT 1

Document info
Document views200
Page views200
Page last viewedSun Dec 11 06:56:26 UTC 2016
Pages70
Paragraphs654
Words2352

Comments