Sha256: 7355b1ff61e5e58b5cc171e15fdf9d39c8250b84707cdd77f8769ed4bc5b9664

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

require_dependency "seo/application_controller"

module Seo
  class SeoPagesController < ApplicationController
    before_action :set_seo_page, only: [:show, :edit, :update, :destroy]

    # GET /seo_pages
    def index
      # Display defaults in the index page if needed.
      @seo_defaults = SeoPageDefault.first
      @seo_pages = SeoPage.all
    end

    # GET /seo_pages/1
    def show
    end

    # GET /seo_pages/new
    def new
      @seo_page = SeoPage.new
    end

    # GET /seo_pages/1/edit
    def edit
    end

    # POST /seo_pages
    def create
      @seo_page = SeoPage.new(seo_page_params)

      if @seo_page.save
        redirect_to @seo_page, notice: 'Seo page was successfully created.'
      else
        render action: 'new'
      end
    end

    # PATCH/PUT /seo_pages/1
    def update
      if @seo_page.update(seo_page_params)
        redirect_to @seo_page, notice: 'Seo page was successfully updated.'
      else
        render action: 'edit'
      end
    end

    # DELETE /seo_pages/1
    def destroy
      @seo_page.destroy
      redirect_to seo_pages_url, notice: 'Seo page was successfully destroyed.'
    end

    private
      # Use callbacks to share common setup or constraints between actions.
      def set_seo_page
        @seo_page = SeoPage.find(params[:id])
      end

      # Only allow a trusted parameter "white list" through.
      def seo_page_params
        params.require(:seo_page).permit(:page_title, :meta_keywords, :meta_description, :url_identifier)
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seo_pages-1.0.0 app/controllers/seo/seo_pages_controller.rb