app/controllers/myreplicator/exports_controller.rb in myreplicator-0.1.0 vs app/controllers/myreplicator/exports_controller.rb in myreplicator-0.1.1

- old
+ new

@@ -43,18 +43,21 @@ def edit @export = Export.find(params[:id]) @dbs = get_dbs @tables = db_metadata @edit = true + @export.schedule # schedule in resque end # POST /exports # POST /exports.json def create @export = Export.new(params[:export]) + @export.schedule # schedule in resque + @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 } else @@ -66,10 +69,11 @@ # PUT /exports/1 # PUT /exports/1.json def update @export = Export.find(params[:id]) + @export.schedule # schedule in resque @dbs = get_dbs respond_to do |format| if @export.update_attributes(params[:export]) format.html { redirect_to @export, notice: 'Export was successfully updated.' } @@ -83,11 +87,15 @@ # DELETE /exports/1 # DELETE /exports/1.json 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