标签: ruby-on-rails ruby-on-rails-3
xxx.find_by_xxx方法似乎选择了记录中的所有列,在处理包含大量列的表时会花费更多不必要的资源。有没有办法选择我想要的唯一列?
答案 0 :(得分:1)
只需添加:选择属性:
Note.find_by_name("Test", :select => "notes.id,notes.name")