Created
September 14, 2012 11:19
-
-
Save tell-k/3721376 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# relationship('Comment', lazy="immediate") | |
# ------------------------------------------ | |
# * 取得タイミング | |
# * 親のモデルがロードされたタイミング一緒にSQL発行 | |
# * lazy="select"とはタイミングが違うだけで発行してるSQLは一緒 | |
# | |
# entry = Entry.query.filter_by(id=1).first() <- タイミングここ | |
# entry.comments | |
# | |
# * 発行SQL | |
# 1. SELECT * FROM entries WHERE entries.id = 1 LIMIT 1 | |
# 2. SELECT * FROM comments WHERE comments.entry_id =1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment