Sha256: e7b5df81fcfcd6d68cda96c087718f3d184c622afab36fe6162ea0c6446130fa

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

require_dependency "phcscriptcdn/application_controller"

module Phcscriptcdn
	class Scriptcdn::ScriptversionsController < ApplicationController

		# Security & Action Filters
		before_action :set_scriptcdn_scriptversion, only: [:edit, :update, :destroy]

		# Script Version Index
		def index
			@scriptcdn_scriptversions = Scriptcdn::Scriptversion.all
		end

		# New Script Version for CDN
		def new
			@scriptcdn_scriptversion = Scriptcdn::Scriptversion.new
		end

		# Edit Script Version
		def edit
		end

		# POST Script Version
		def create
			@scriptcdn_scriptversion = Scriptcdn::Scriptversion.new(scriptcdn_scriptversion_params)

			if @scriptcdn_scriptversion.save
				redirect_to scriptcdn_scriptversions_path, notice: 'Script version was successfully created.'
			else
				render :new
			end
		end

		# PATCH/PUT Script Version
		def update
			if @scriptcdn_scriptversion.update(scriptcdn_scriptversion_params)
				redirect_to scriptcdn_scriptversions_path, notice: 'Script version was successfully updated.'
			else
				render :edit
			end
		end

		# DELETE Script Version
		def destroy
			@scriptcdn_scriptversion.destroy
			redirect_to scriptcdn_scriptversions_path, notice: 'Script version was successfully destroyed.'
		end

		private
		
		# Callbacks
		def set_scriptcdn_scriptversion
			@scriptcdn_scriptversion = Scriptcdn::Scriptversion.find(params[:id])
		end

		# Whitelist
		def scriptcdn_scriptversion_params
			params.require(:scriptcdn_scriptversion).permit(:scrptversion, :scrptversionpakname)
		end

	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
phcscriptcdn-1.2.0 app/controllers/phcscriptcdn/scriptcdn/scriptversions_controller.rb
phcscriptcdn-1.1.0 app/controllers/phcscriptcdn/scriptcdn/scriptversions_controller.rb