Ruby rails - select only few columns from the data base

前端 未结 6 1518
[愿得一人]
[愿得一人] 2020-12-15 02:16

What is the way in rails to structure sql query to only select certain columns from the database, I have some large data fields which I want to avoid loading from continuous

6条回答
  •  无人及你
    2020-12-15 03:16

    Try this:

    @itemlist = Item.find(:all, :select => "name, address", :conditions => { .... } )
    

提交回复
热议问题