Today I tried to improve the performance of my action by doing just one db call through eager loading. For those who have no idea what it is, please read our previous post
http://twoblinddevs.blogspot.com/search?q=eager+loading
This is what I wanted to do
Person.find(:first, :include=>[ :person_info, :messages], :conditions=>["id = :user_id", { :user_id => session[:id]}] )
when I refreshed the browser, it shows me this error message - Mcolumn reference "id" is ambiguous.
The reason rails complain is because all three tables have an id column. In order to work around this problem, you simply have to change id = :user_id to people.id = :user_id
J
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment