Commit 67c6ec49bbd4040eb9cecc52a696805c56d90ef7

Authored by Larissa Reis
1 parent 20c9a186

Forces users xml file to be downloaded

  Forces the users xml file to be downloaded instead of parsed by the
  browser, which was a little annoying if the xml was too big since
  the browser would want to load it all.

(ActionItem2284)
Showing 1 changed file with 6 additions and 5 deletions   Show diff stats
app/controllers/admin/users_controller.rb
... ... @@ -7,11 +7,12 @@ class UsersController < AdminController
7 7 format.html
8 8 format.xml do
9 9 @users = User.find(:all, :conditions => {:environment_id => environment.id}, :include => [:person])
10   - render :xml => @users.to_xml(
11   - :skip_types => true,
12   - :only => %w[email login created_at updated_at],
13   - :include => { :person => {:only => %w[name updated_at created_at address birth_date contact_phone identifier lat lng] } }
14   - )
  10 + send_data @users.to_xml(
  11 + :skip_types => true,
  12 + :only => %w[email login created_at updated_at],
  13 + :include => { :person => {:only => %w[name updated_at created_at address birth_date contact_phone identifier lat lng] } }),
  14 + :type => 'text/xml',
  15 + :disposition => "attachment; filename=users.xml"
15 16 end
16 17 format.csv do
17 18 @users = User.find(:all, :conditions => {:environment_id => environment.id}, :include => [:person])
... ...