Hi, I have a Person model and Company model like as follows:- Person.rb class Person <ActiveRecord::Base has_one :company end Company.rb class Company < ActiveRecord::Base end I have a function def person_details @person=Person.find(params[:id, :include=> :company) end person_details.html.erb <%=@person.name%> : <%=@person.company.name%> I read that if you use the :include option then it reduces your number of queries. Means, whenever it is firing a query to find person same time it eager loads the company association. I am confused that what exactly it does? Is it load the company object in memory? and instead of going to database it takes it from memory. Can anyone elaborate me what exactly happens when we use the :include option. Thanks, Mike
on 2010-08-10 14:43
on 2010-08-10 14:45
Sorry for posting the question in Rails deployment section. I have added in Ruby On Rails section. Mike Disuza wrote:
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.