Rails Error :Column 'id' in order clause is ambiguous

错误Column 'id' in order clause is ambiguous 易出现在
=  Product.find(:all,:include => :kind,:order => " id desc " )
类似的语句上,用include包含了一个left join对象,所以id可能存在于多个表内,就引起了二义性
修改为
=  Product.find(:all,:include => :kind,:order => " products.id desc " )
属性前加上表名
一切OK

你可能感兴趣的:(column)