Last active
August 24, 2016 13:55
-
-
Save piotrze/375953e58b9068ecfccdc7ac67803bf2 to your computer and use it in GitHub Desktop.
Extract method with block
This file contains hidden or 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
def generate | |
prefetch_volunteers do |volunteer| | |
csv << VolunteerPresenter.new(volunteer).to_csv | |
end | |
end | |
private | |
def prefetch_volunteers | |
@volunteers.includes( | |
[:user, { taggings: :tag }] | |
).find_each(batch_size: 1000, &Proc.new) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment