Ruby on Rails
Wednesday, April 1, 2015
On Wednesday, April 1, 2015 at 4:32:16 PM UTC+1, mingm...@gmail.com wrote:
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!
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2fb5c399-3134-43db-8b7a-1ee24cfbc2be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment