Sha256: 51a36faf7243ba0c240e8e91e98e8c36972a0eb3868ceb8ae4f257142105e688

Contents?: true

Size: 1.51 KB

Versions: 54

Compression:

Stored size: 1.51 KB

Contents

require_dependency "phcscriptcdn/application_controller"

module Phcscriptcdn
  class Script::AuthorsController < ApplicationController

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

    # INDEX - Script Author
    def index
      @script_authors = Script::Author.all
    end

    # DETAILS - Script Author
    def show
    end

    # NEW - Script Author
    def new
      @script_author = Script::Author.new
    end

    # EDIT - Script Author
    def edit
    end

    # CREATE - Script Author
    def create
      @script_author = Script::Author.new(script_author_params)
      if @script_author.save
        redirect_to script_authors_url, notice: 'Author was successfully created.'
        else
          render :new
      end
    end

    # PATCH/PUT - Script Author
    def update
      if @script_author.update(script_author_params)
        redirect_to script_authors_url, notice: 'Author was successfully updated.'
        else
          render :edit
      end
    end

    # DELETE - Script Author
    def destroy
      @script_author.destroy
      redirect_to script_authors_url, notice: 'Author was successfully destroyed.'
    end

    private

    # Common Callbacks
    def set_script_author
      @script_author = Script::Author.find(params[:id])
    end

    # Whitelist
    def script_author_params
      params.require(:script_author).permit(:authorfirstname, :authorlastname, :authorwebsite, :authorgithub, :authortwitter, :slug, :user_id, :user_name)
    end

  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
phcscriptcdn-48.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-47.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-44.1.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-45.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-44.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-43.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-42.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-41.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-40.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-38.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-37.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-36.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-35.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-34.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-33.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-32.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-31.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-30.0.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-29.2.0 app/controllers/phcscriptcdn/script/authors_controller.rb
phcscriptcdn-29.1.0 app/controllers/phcscriptcdn/script/authors_controller.rb