app/controllers/phcscriptcdnpro/scriptcdn/urls_controller.rb in phcscriptcdnpro-1.5.6 vs app/controllers/phcscriptcdnpro/scriptcdn/urls_controller.rb in phcscriptcdnpro-1.5.7

- old
+ new

@@ -1,14 +1,14 @@ require_dependency "phcscriptcdnpro/application_controller" module Phcscriptcdnpro - class Scriptcdn::ScripturlsController < ApplicationController + class Scriptcdn::UrlsController < ApplicationController # Security & Action Filters before_action :require_user layout '/layouts/phcscriptcdnpro/application.html.erb' - before_action :set_scriptcdn_scripturl, only: [:edit, :update, :destroy] + before_action :set_scriptcdn_url, only: [:edit, :update, :destroy] # Index for Script URL def index scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_scripturls = scriptcdn_main.urls @@ -31,14 +31,14 @@ end # POST Script URL def create @scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) - @scriptcdn_url = @scriptcdn_main.urls.create(scriptcdn_scripturl_params) + @scriptcdn_url = @scriptcdn_main.urls.create(scriptcdn_url_params) respond_to do |format| if @scriptcdn_url.save - format.html { redirect_to scriptcdn_script_scripturls_path, notice: 'Script URL was Successfully Created.' } + format.html { redirect_to scriptcdn_main_urls_path, notice: 'Script URL was Successfully Created.' } format.json { render action: 'show', status: :created, location: @scriptcdn_url } else format.html { render action: 'new' } format.json { render json: @scriptcdn_url.errors, status: :unprocessable_entity } end @@ -46,12 +46,12 @@ end # PATCH/PUT Script URL def update respond_to do |format| - if @scriptcdn_url.update(scriptcdn_scripturl_params) - format.html { redirect_to scriptcdn_script_scripturls_path, notice: 'Script URL was Successfully Updated.' } + if @scriptcdn_url.update(scriptcdn_url_params) + format.html { redirect_to scriptcdn_main_urls_path, notice: 'Script URL was Successfully Updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @scriptcdn_url.errors, status: :unprocessable_entity } end @@ -62,23 +62,23 @@ def destroy @scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) @scriptcdn_url = @scriptcdn_main.urls.find(params[:id]) @scriptcdn_url.destroy respond_to do |format| - format.html { redirect_to scriptcdn_script_scripturls_path, notice: 'Script URL was Successfully Deleted.' } + format.html { redirect_to scriptcdn_main_urls_path, notice: 'Script URL was Successfully Deleted.' } format.json { head :no_content } end end private # Common Callbacks - def set_scriptcdn_scripturl + def set_scriptcdn_url @scriptcdn_url = Scriptcdn::Url.find(params[:id]) end # Whitelist - def scriptcdn_scripturl_params + def scriptcdn_url_params params.require(:scriptcdn_url).permit(:scripturl, :main_id) end end end \ No newline at end of file