diff options
author | Christopher Baines <mail@cbaines.net> | 2018-01-27 23:23:05 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-03-29 07:28:05 +0100 |
commit | eb3177b0d8de10f316ac595dff3b8165cf828796 (patch) | |
tree | 501b338a14a3cedc71c9a33a17d5810848374572 /app/controllers | |
download | govuk-mini-environment-admin-eb3177b0d8de10f316ac595dff3b8165cf828796.tar govuk-mini-environment-admin-eb3177b0d8de10f316ac595dff3b8165cf828796.tar.gz |
Initial commit
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/application_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/mini_environments_controller.rb | 21 |
2 files changed, 27 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..85c44e9 --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,6 @@ +class ApplicationController < ActionController::Base + include GDS::SSO::ControllerMethods + before_action :authenticate_user! + + protect_from_forgery with: :exception +end diff --git a/app/controllers/mini_environments_controller.rb b/app/controllers/mini_environments_controller.rb new file mode 100644 index 0000000..c45ed4a --- /dev/null +++ b/app/controllers/mini_environments_controller.rb @@ -0,0 +1,21 @@ +class MiniEnvironmentsController < ApplicationController + def show + @mini_environment = MiniEnvironment.find(params[:id]) + end + + def new + @mini_environment = MiniEnvironment.new + end + + def create + ActiveRecord::Base.transaction do + @mini_environment = MiniEnvironment.create( + params.require(:mini_environment).permit(:name) + ) + + SetupJob.enqueue(@mini_environment.id) + end + + redirect_to @mini_environment + end +end |