I want to use the remove_file and template methods from the Thor toolkit in the create action of a rails controller.
pages_controller.rb (although it makes no sense)
class PagesController < ApplicationController
....
def create
@page = Page.new(page_params)
respond_to do |format|
if @page.save
remove_file old_file
template new_file, old_file
else
format.html { render :new }
format.json { render json: @page.errors, status: :unprocessable_entity }
end
end
end
....
end
I feel like it is really simple but I have no idea how to make this work.
Any help is greatly appreciated!
