app/controllers/admin_controller.rb
def export_db
    filename = "dump_" + Time.now.strftime('%Y-%m-%d-%H-%M') + ".txt"
    dump = {}
    dump['activties'] = Activity.find(:all)
    dump['clients'] = Client.find(:all)
    dump['invoices'] = Invoice.find(:all)
    dump['projects'] = Project.find(:all)
    dump['roles'] = Role.find(:all)
    dump['users'] = User.find(:all)
    dumped_data = dump.to_yaml
    dumped_data.gsub(/\n/,"\r\n")
    send_data(dumped_data,
      :type => 'text/plain; charset=utf-8; header=present',
      :filename => filename)
  end
#
# Dumps database to YAML format and sends it to browser
# The dump is created in memory
#
Dumps database to YAML format and sends it to browser
The dump is created in memory
Dumps database to YAML format and sends it to browser The dump is created in memory
def export_db
    filename = "dump_" + Time.now.strftime('%Y-%m-%d-%H-%M') + ".txt"
    dump = {}
    dump['activties'] = Activity.find(:all)
    dump['clients'] = Client.find(:all)
    dump['invoices'] = Invoice.find(:all)
    dump['projects'] = Project.find(:all)
    dump['roles'] = Role.find(:all)
    dump['users'] = User.find(:all)
    dumped_data = dump.to_yaml
    dumped_data.gsub(/\n/,"\r\n")
    send_data(dumped_data,
      :type => 'text/plain; charset=utf-8; header=present',
      :filename => filename)
  end
def export_db filename = "dump_" + Time . now . strftime ( '%Y-%m-%d-%H-%M' ) + ".txt" dump = { } dump [ 'activties' ] = Activity . find ( :all ) dump [ 'clients' ] = Client . find ( :all ) dump [ 'invoices' ] = Invoice . find ( :all ) dump [ 'projects' ] = Project . find ( :all ) dump [ 'roles' ] = Role . find ( :all ) dump [ 'users' ] = User . find ( :all ) dumped_data = dump . to_yaml dumped_data . gsub ( / \n / , "\r\n" ) send_data ( dumped_data , :type => 'text/plain; charset=utf-8; header=present' , :filename => filename ) end
Dumps database to YAML format and sends it to browser
The dump is created in memory
Dumps database to YAML format and sends it to browser The dump is created in memory