app/controllers/phcscriptcdnpro/scriptcdn/authors_controller.rb in phcscriptcdnpro-1.4.2 vs app/controllers/phcscriptcdnpro/scriptcdn/authors_controller.rb in phcscriptcdnpro-1.4.4

- old
+ new

@@ -1,6 +1,6 @@ - require_dependency "phcscriptcdnpro/application_controller" +require_dependency "phcscriptcdnpro/application_controller" module Phcscriptcdnpro class Scriptcdn::AuthorsController < ApplicationController # Security & Action Filters @@ -8,30 +8,30 @@ layout '/layouts/phcscriptcdnpro/application.html.erb' before_action :set_scriptcdn_author, only: [:edit, :update, :destroy] # Author Index def index - scriptcdn_script = Scriptcdn::Script.find(params[:script_id]) - @scriptcdn_authors = scriptcdn_script.authors + scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) + @scriptcdn_authors = scriptcdn_main.authors end # New Author def new - scriptcdn_script = Scriptcdn::Script.find(params[:script_id]) - @scriptcdn_author = scriptcdn_script.authors.build + scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) + @scriptcdn_author = scriptcdn_main.authors.build end # Edit Author def edit - scriptcdn_script = Scriptcdn::Script.find(params[:script_id]) - @scriptcdn_author = scriptcdn_script.authors.find(params[:id]) + scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) + @scriptcdn_author = scriptcdn_main.authors.find(params[:id]) end # POST Author def create - @scriptcdn_script = Scriptcdn::Script.find(params[:script_id]) - @scriptcdn_author = @scriptcdn_script.authors.create(scriptcdn_author_params) + @scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) + @scriptcdn_author = @scriptcdn_main.authors.create(scriptcdn_author_params) if @scriptcdn_author.save redirect_to @scriptcdn_author, notice: 'Author was successfully created.' else render :new end @@ -46,20 +46,20 @@ end end # DELETE Author def destroy - @scriptcdn_script = Scriptcdn::Script.find(params[:script_id]) - @scriptcdn_author = @scriptcdn_script.authors.find(params[:id]) + @scriptcdn_main = Scriptcdn::Main.find(params[:main_id]) + @scriptcdn_author = @scriptcdn_main.authors.find(params[:id]) @scriptcdn_author.destroy redirect_to scriptcdn_authors_url, notice: 'Author was successfully destroyed.' end private # Common Callbacks def set_scriptcdn_author - @scriptcdn_author = Scriptcdn::Author.find(params[:id]) + @scriptcdn_author = Scriptcdn::Author.find(params[:id]) end # Whitelist def scriptcdn_author_params params.require(:scriptcdn_author).permit(:authorfirstname, :authorlastname, :authoremail, :authorgithub, :authortwitter, :script_id)