Questions tagged «dynamic-finders»

12
find vs find_by vs where
我是新手。我看到有很多找到记录的方法: find_by_<columnname>(<columnvalue>) find(:first, :conditions => { <columnname> => <columnvalue> } where(<columnname> => <columnvalue>).first 而且看起来它们所有人最终都生成完全相同的SQL。另外,我认为查找多个记录也是如此: find_all_by_<columnname>(<columnvalue>) find(:all, :conditions => { <columnname> => <columnvalue> } where(<columnname> => <columnvalue>) 是否有经验法则或推荐使用哪个准则?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.