Sha256: b290da9590f8c6ecf4f60af48af8dd8bee719caf3ce12228c1974788df9dd6ce

Contents?: true

Size: 1.41 KB

Versions: 61

Compression:

Stored size: 1.41 KB

Contents

require_dependency "phcscriptcdnpro/application_controller"

module Phcscriptcdnpro
	class Script::VersionsController < ApplicationController

		# Filters & Security
		before_action :require_user
		before_action :set_script_version, only: [:show, :edit, :update, :destroy]

		# INDEX - Script Versions
		def index
			@script_versions = Script::Version.all
		end

		# DETAILS - Script Versions
		def show
		end

		# NEW - Script Versions
		def new
			@script_version = Script::Version.new
		end

		# EDIT - Script Versions
		def edit
		end

		# POST - Script Versions
		def create
			@script_version = Script::Version.new(script_version_params)
			if @script_version.save
				redirect_to script_versions_url, notice: 'Version was successfully created.'
				else
					render :new
			end
		end

		# PATCH/PUT - Script Versions
		def update
			if @script_version.update(script_version_params)
				redirect_to script_versions_url, notice: 'Version was successfully updated.'
				else
					render :edit
			end
		end

		# DELETE - Script Versions
		def destroy
		@script_version.destroy
		redirect_to script_versions_url, notice: 'Version was successfully destroyed.'
		end

		private

		# Common Callbacks
		def set_script_version
		@script_version = Script::Version.find(params[:id])
		end

		# Only allow a trusted parameter "white list" through.
		def script_version_params
			params.require(:script_version).permit(:scriptversion)
		end

	end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
phcscriptcdnpro-3.3.4 app/controllers/phcscriptcdnpro/script/versions_controller.rb