diff options
author | Mark Longair <mhl@pobox.com> | 2013-11-19 11:59:52 +0000 |
---|---|---|
committer | Mark Longair <mhl@pobox.com> | 2013-11-19 11:59:52 +0000 |
commit | 231657cdc503b95b5075ff11e018ca9c63f3e59c (patch) | |
tree | 9b9f45acdc0b5b34c4ff93dc7c070ad4a6f72b81 /app/models/public_body.rb | |
parent | 95937d77a4cd7301f932e0f893af1efb37524147 (diff) | |
parent | c1ee22fe8df92b03573a03e13f6fd692c9074dd0 (diff) |
Merge branch 'all-authorities-reduce-memory' into rails-3-develop
This has already been cherry-picked into the wdtk branch, but
it should also be merged into rails-3-develop
Diffstat (limited to 'app/models/public_body.rb')
-rw-r--r-- | app/models/public_body.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb index fbe2956e3..db6359f6b 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -514,10 +514,8 @@ class PublicBody < ActiveRecord::Base end # Returns all public bodies (except for the internal admin authority) as csv - def self.export_csv - public_bodies = PublicBody.visible.find(:all, :order => 'url_name', - :include => [:translations, :tags]) - FasterCSV.generate() do |csv| + def self.export_csv(output_filename) + CSV.open(output_filename, "w") do |csv| csv << [ 'Name', 'Short name', @@ -532,7 +530,7 @@ class PublicBody < ActiveRecord::Base 'Updated at', 'Version', ] - public_bodies.each do |public_body| + PublicBody.visible.find_each(:include => [:translations, :tags]) do |public_body| # Skip bodies we use only for site admin next if public_body.has_tag?('site_administration') csv << [ |