Being that it is better to call a SQL database with the specific item, for example:
Bad:
SELECT * FROM tblUsers
Good:
SELECT email FROM tblUsers
How would I do this in开发者_如何学运维 RoR to make it explicitly perform the latter example?
Assuming your tblUsers
table is used by User
model, you should do
User.all(:select => "email")
精彩评论