Class: Burn::BurnController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/app/controllers/burn/burn_controller.rb

Overview

A simple controller which allows for backups and restores.

  • GET /burn/backup gets the latest backup

  • POST /burn/restore restores to the backup posted as params[:backup][:data]

Instance Method Summary collapse

Instance Method Details

#backupObject

Gets the latest backup



9
10
11
12
13
# File 'lib/app/controllers/burn/burn_controller.rb', line 9

def backup
  respond_to do |format|
    format.html { send_data build_backup }
  end
end

#restoreObject

Restores from a backup



16
17
18
19
20
21
22
# File 'lib/app/controllers/burn/burn_controller.rb', line 16

def restore
  load_backup params[:backup][:data].read

  respond_to do |format|
    format.html { head :ok }
  end
end