Peer Allan wrote:
I have a really quick question on the number of SQL calls I am seeing in
my development log when it comes to associations. This may just be an
environment issue, but I could not find an answer.
If I have a belongs_to association for books to a library for example.
class Library < ActiveRecord::Base
class Book < ActiveRecord::Base
Could you elaborate on the problem more? What are you calling in your application that seems to be generating a lot of extra SQL calls?
@library = Library.find(10)
Something like this?
If so, you might look at the :include option for .find() which will prevent a lot of extra queries.