假设我有模型(客户)与以下的列ACCOUNT_ID,USER_ID,party_id,日期和名称哪给了我更好的性能Activerecord find_by或者哪里?
,我执行:
Account.find_by_account_id_and_user_id_and_party_id_and_date_and_name(1,2,3,"2012-03-12","Venus")
和
Account.where(:account_id => 1, :user_id => 2, :party_id => 3,:date => "2012-03-28",:name => "Venus").limit(1).first
哪位能给我更好的性能?
谢谢Veraticus。我不知道find_by这个method_missing概念。我知道这两种方式都是相同的查询和使用哪种方式更清晰的方式来编写大型查询 – AnkitG 2012-08-08 06:05:19