I have a Person model and Company model like as follows:-
class Person <ActiveRecord::Base
class Company < ActiveRecord::Base
I have a function
@person=Person.find(params[:id, :include=> :company)
<%=@person.name%> : <%=@person.company.name%>
I read that if you use the :include option then it reduces your number
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