Sha256: 9a21f08b534d509a22d13b42071a65c7648dbeb4eefb78f77cb53d7da247d0bf

Contents?: true

Size: 1.08 KB

Versions: 25

Compression:

Stored size: 1.08 KB

Contents

module Workarea
  module Admin
    class CreateReleaseUndosController < Admin::ApplicationController
      required_permissions :releases

      before_action :find_release
      before_action :find_undo_release

      def new
      end

      def create
        @undo_release.attributes = params[:release]

        if @undo_release.save
          @release.changesets.each do |changeset|
            changeset.build_undo(release: @undo_release.model).save!
          end

          flash[:success] = t('workarea.admin.create_release_undos.flash_messages.saved')
          redirect_to review_release_undo_path(@release)
        else
          render :new, status: :unprocessable_entity
        end
      end

      def review
      end

      private

      def find_release
        model = Release.find(params[:release_id])
        @release = ReleaseViewModel.new(model, view_model_options)
      end

      def find_undo_release
        model = @release.model.undo || @release.build_undo(params[:release])
        @undo_release = ReleaseViewModel.new(model, view_model_options)
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
workarea-admin-3.5.23 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.22 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.21 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.20 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.19 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.18 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.17 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.16 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.15 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.14 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.13 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.12 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.11 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.10 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.9 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.8 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.7 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.6 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.5 app/controllers/workarea/admin/create_release_undos_controller.rb
workarea-admin-3.5.4 app/controllers/workarea/admin/create_release_undos_controller.rb