Created
October 18, 2010 12:00
-
-
Save mataki/632095 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
# Group -has_many-> Participation | |
# Group.joined ==> defined named_scope | |
# Group.user_id_not_null ==> genarated named_scope by searchlogic | |
g = Group.find(1) | |
# SQL) SELECT * FROM `groups` WHERE (`groups`.`id` = 1) | |
g.participations | |
# SQL) SELECT * FROM `participations` WHERE (`participations`.group_id = 1) | |
g.participations.joined.user_id_not_null | |
# Acctual SQL) SELECT * FROM `participations` WHERE ((participations.user_id IS NOT NULL) AND (participations.status = 'ACTIVE')) | |
# Collect SQL) SELECT * FROM `participations` WHERE ((participations.user_id IS NOT NULL) AND ((participations.status = 'ACTIVE') AND (`participations`.group_id = 1))) | |
g.participations.joined.user_id_not_null # Redo | |
# SQL) SELECT * FROM `participations` WHERE (`participations`.group_id = 1) AND ((participations.user_id IS NOT NULL) AND (participations.status = 'ACTIVE')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment