All examples: include for active loading are for class-level queries. I tried this on the model instance, and it still returned a bunch of requests - does it work on instance methods?
#in controller @emails = person.sent_emails(:include => [:recipient]) #in view render @emails # _email.html.erb partial <h1><%= email.recipient.name %></h1> <p> <%= email.content %> </p> #still issues a select * for emails, N+1 for recipients :/
It looks a bit Rails 2ish, which I know, and may be the best Rails 3, but it works.
@emails = person.sent_emails.find(:all, :include => :recipient)
Edit: see BaroqueBobcat's comment for a better method in Rails 3
Source: https://habr.com/ru/post/887575/More articles:#include - Xcode - mallocHow to properly block List getter in C # - listDisplay modal dialog with jquery ui without element? - javascriptWhat is the difference between developer.paypal.com and x.com? - paypalPacking two shorts into one int dealing with negative and positive - javahttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/887576/rails-3-devise-grinds-to-halt-with-more-encryption-stretches&usg=ALkJrhh_zTenEKmKQtr8oY6FQ9O-E-nZCQIs it possible to insert a form into an html table? - htmlRemoving database content, precautions - securityOrganization IP address range data generation - httpHow can I get the value of a DataGridViewCell from the Cell_Leave event? - c #All Articles