Join types

I'm sure this is not a new topic -- I've read mention of it elsewhere -- but in addition to :joins => :profile, Active Record also needs :inner_joins => :profile, :outer_joins => :profile, :left_joins => :profile, and all the popular combinations of join types.

I've got a sqlite development environment with mysql in production. mysql says "what?" when it see LEFT OUTER JOIN.

I'm going to try playing with database specific code through the ActiveRecord::Base.instanceof? method, but that certainly isn't a particularly elegant approach.

Why not just use :include? Then it will be portable and do the right type of join (or maybe no join at all if not needed)

JohnnyC wrote:

I'm sure this is not a new topic -- I've read mention of it elsewhere -- but in addition to :joins => :profile, Active Record also needs :inner_joins => :profile, :outer_joins => :profile, :left_joins => :profile, and all the popular combinations of join types.

I've got a sqlite development environment with mysql in production. mysql says "what?" when it see LEFT OUTER JOIN.

That's probably not the actual issue. According to http://dev.mysql.com/doc/refman/5.0/en/join.html , LEFT OUTER JOIN is legal in MySQL.

What errors are you actually getting?

Best,