If I define a model like this
class Article #It has fields: title, context(long text) end
How can I retrieve articles without ‘context’ field loaded?
Thank you!
If I define a model like this
class Article #It has fields: title, context(long text) end
How can I retrieve articles without ‘context’ field loaded?
Thank you!
If I define a model like this
class Article #It has fields: title, context(long text) end
How can I retrieve articles without ‘context’ field loaded?
You can limit what is returned with select - Article.select(‘id, title’) although there is no way that I am aware of to say ‘all columns except this one’ without explicitly listing them).
If you do this article.context would raise an error (MissingAttributeError if my memory is correct) - I think you’ll have to reload the record if you do decide that you want to use that column for a particular instance
Fred
Thank you , Fred!
在 2015年4月1日星期三 UTC+8下午11:37:14,Frederick Cheung写道: