scenario_imports_controller.rb 486B

12345678910111213141516
  1. class ScenarioImportsController < ApplicationController
  2. def new
  3. @scenario_import = ScenarioImport.new(:url => params[:url])
  4. end
  5. def create
  6. @scenario_import = ScenarioImport.new(params[:scenario_import])
  7. @scenario_import.set_user(current_user)
  8. if @scenario_import.valid? && @scenario_import.import_confirmed? && @scenario_import.import
  9. redirect_to @scenario_import.scenario, notice: "Import successful!"
  10. else
  11. render action: "new"
  12. end
  13. end
  14. end