Created
December 4, 2015 17:07
-
-
Save plainprogrammer/d81591bde7d4463734cd 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
current_user = User.where(full_name: "Jane Fonda").first | |
current_user.connections.where("full_name LIKE ?", "%bus%").select(:id, :full_name) | |
# | |
# User Load (0.6ms) | |
# SELECT `users`.`id`, `users`.`full_name` FROM `users` | |
# INNER JOIN `contacts` ON `users`.`id` = `contacts`.`connection_id` | |
# WHERE `contacts`.`user_id` = 980204181 | |
# AND (full_name LIKE '%bus%') | |
# | |
# => #<ActiveRecord::AssociationRelation [ | |
# #<User id: 550816050, full_name: "all business admin">, | |
# #<User id: 796115996, full_name: "all business member"> | |
# ]> | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment