1
0

scenario_imports_controller.rb 620 B

12345678910111213141516171819202122
  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(scenario_import_params)
  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. private
  15. def scenario_import_params
  16. params.require(:scenario_import).permit(:url, :data, :file, :do_import, merges: {})
  17. end
  18. end