Class: Myreplicator::ExportsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Myreplicator::ExportsController
- Defined in:
- app/controllers/myreplicator/exports_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /exports POST /exports.json.
-
#destroy ⇒ Object
DELETE /exports/1 DELETE /exports/1.json.
-
#edit ⇒ Object
GET /exports/1/edit.
-
#index ⇒ Object
GET /exports GET /exports.json.
-
#new ⇒ Object
GET /exports/new GET /exports/new.json.
-
#show ⇒ Object
GET /exports/1 GET /exports/1.json.
-
#update ⇒ Object
PUT /exports/1 PUT /exports/1.json.
Instance Method Details
#create ⇒ Object
POST /exports POST /exports.json
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'app/controllers/myreplicator/exports_controller.rb', line 52 def create @export = Export.new(params[:export]) @dbs = get_dbs respond_to do |format| if @export.save format.html { redirect_to @export, notice: 'Export was successfully created.' } format.json { render json: @export, status: :created, location: @export } Myreplicator::Export.schedule_in_resque # schedule in resque else format.html { render action: "new" } format.json { render json: @export.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /exports/1 DELETE /exports/1.json
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'app/controllers/myreplicator/exports_controller.rb', line 87 def destroy @export = Export.find(params[:id]) # remove from Resque Resque.remove_schedule(@export.schedule_name) @export.destroy respond_to do |format| format.html { redirect_to exports_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /exports/1/edit
43 44 45 46 47 48 |
# File 'app/controllers/myreplicator/exports_controller.rb', line 43 def edit @export = Export.find(params[:id]) @dbs = get_dbs @tables = @edit = true end |
#index ⇒ Object
GET /exports GET /exports.json
10 11 12 13 14 15 16 17 |
# File 'app/controllers/myreplicator/exports_controller.rb', line 10 def index @exports = Export.paginate(:page => params[:page]).order(sort_column + " " + sort_direction) respond_to do |format| format.html # index.html.erb format.json { render json: @exports } end end |
#new ⇒ Object
GET /exports/new GET /exports/new.json
32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/myreplicator/exports_controller.rb', line 32 def new @export = Export.new @dbs = get_dbs @tables = respond_to do |format| format.html # new.html.erb format.json { render json: @export } end end |
#show ⇒ Object
GET /exports/1 GET /exports/1.json
21 22 23 24 25 26 27 28 |
# File 'app/controllers/myreplicator/exports_controller.rb', line 21 def show @export = Export.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @export } end end |
#update ⇒ Object
PUT /exports/1 PUT /exports/1.json
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'app/controllers/myreplicator/exports_controller.rb', line 69 def update @export = Export.find(params[:id]) @dbs = get_dbs respond_to do |format| if @export.update_attributes(params[:export]) format.html { redirect_to @export, notice: 'Export was successfully updated.' } format.json { head :no_content } Myreplicator::Export.schedule_in_resque # schedule in resque else format.html { render action: "edit" } format.json { render json: @export.errors, status: :unprocessable_entity } end end end |