Rails: Load just one attribute not a whole model
问题 Lets say I have a model, Foo , which is big and has lots of components. For a given Ajax query I'm only interested in one particular attribute, bar , which is a column in the foos table. Is there a simple way I could load just that attribute, and not bother with retrieving the rest of the record? For instance if all I want to know is the bar for Foo with id# _ _, how could I retrieve that? 回答1: You can return only specific columns by calling the select method with a string containing the