Няма описание http://j1x-huginn.herokuapp.com

scenario_imports_controller.rb 712B

12345678910111213141516171819202122232425
  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. merges = params[:scenario_import].delete(:merges)
  17. params.require(:scenario_import).permit(:url, :data, :file, :do_import) do |params|
  18. params[:merges] = merges
  19. end
  20. end
  21. end