Skip to content

Commit

Permalink
#2 Clean up controller
Browse files Browse the repository at this point in the history
  • Loading branch information
marjinal1st committed Jan 3, 2014
1 parent 6dc844b commit 5b8af6b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
9 changes: 0 additions & 9 deletions app/controllers/kebapage/static_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,20 @@ module Kebapage
class StaticPagesController < ApplicationController
before_action :set_static_page, only: [:show, :edit, :update, :destroy]

# GET /static_pages
def index
@static_pages = StaticPage.all
end

# GET /static_pages/1
def show
end

# GET /static_pages/new
def new
@static_page = StaticPage.new
end

# GET /static_pages/1/edit
def edit
end

# POST /static_pages
def create
@static_page = StaticPage.new(static_page_params)

Expand All @@ -33,7 +28,6 @@ def create
end
end

# PATCH/PUT /static_pages/1
def update
if @static_page.update(static_page_params)
redirect_to @static_page, notice: 'Static page was successfully updated.'
Expand All @@ -42,19 +36,16 @@ def update
end
end

# DELETE /static_pages/1
def destroy
@static_page.destroy
redirect_to static_pages_url, notice: 'Static page was successfully destroyed.'
end

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

# Only allow a trusted parameter "white list" through.
def static_page_params
params.require(:static_page).permit(:title, :content)
end
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Kebapage::Engine.routes.draw do
resources :static_pages
root 'static_pages#index'
end

0 comments on commit 5b8af6b

Please sign in to comment.