Last active
December 31, 2016 00:00
-
-
Save MaxPleaner/3d2607036a8cab9a48b5f6fcb600e0ae to your computer and use it in GitHub Desktop.
active record preload_map
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
class ActiveRecord::Query | |
def preload_map(association_name_sym) | |
preload(association_name_sym).map &association_name_sym | |
end | |
alias map_with_preload preload_map | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment