标签: ruby ruby-on-rails-4
发现策略差异,陈述每个语句的用例,并为两者编写生成的SQL。
users = User.joins(:company).entries users.each { |u| { email: u.email, company: u.company.name } }
Vs
users = User.includes(:company).entries users.each { |u| { email: u.email, company: u.company.name } }