Ruby rails - select only few columns from the database
rails-activerecord, ruby, ruby-on-rails, ruby-on-rails-3
Solution
Rails 3:
`Item.select("name, address").where( .... )`
Problem
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 periodic Ajax calls. Reading unnecessarily is resource consuming and slow. ``` @itemlist = Item.find(:all, :conditions => { .... } ) #this select all columns ``` I am looking for `SELECT name, address FROM users;` instead of `SELECT * FROM users;`