Sha256: 954711c3090288a1d4e9072fb2e8ad877f9dd6f517833cfca0d24f27c5846f13
Contents?: true
Size: 1.79 KB
Versions: 4
Compression:
Stored size: 1.79 KB
Contents
require_dependency "phcscriptcdnpro/application_controller" module Phcscriptcdnpro class Scriptcdn::UrlsController < ApplicationController # Security & Action Filters before_action :require_user layout '/layouts/phcscriptcdnpro/application.html.erb' before_action :set_scriptcdn_url, only: [:edit, :update, :destroy] # Index for Script URL def index scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_urls = scriptcdn_main.urls end # New Script URL def new scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_url = scriptcdn_main.urls.build end # Edit Script URL def edit scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_url = scriptcdn_main.urls.find(params[:id]) end # POST Script URL def create @scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_url = @scriptcdn_main.urls.create(scriptcdn_url_params) if @scriptcdn_url.save redirect_to scriptcdn_main_urls_path, notice: 'Script URL was successfully created.' else render :new end end # PATCH/PUT Script URL def update if @scriptcdn_url.update(scriptcdn_url_params) redirect_to scriptcdn_main_urls_path, notice: 'Script URL was successfully updated.' else render :edit end end # Delete Script URL def destroy @scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_url = @scriptcdn_main.urls.find(params[:id]) @scriptcdn_url.destroy redirect_to scriptcdn_main_urls_path, notice: 'Script url was successfully destroyed.' end private # Common Callbacks def set_scriptcdn_url @scriptcdn_url = Scriptcdn::Url.find(params[:id]) end # Whitelist def scriptcdn_url_params params.require(:scriptcdn_url).permit(:scripturl, :scripturlext, :main_id) end end end
Version data entries
4 entries across 4 versions & 1 rubygems