Sha256: 1434d794c085677f4de9c06fb058ad5f1bb64a69038f166bf7e185e0e83c5100

Contents?: true

Size: 877 Bytes

Versions: 3

Compression:

Stored size: 877 Bytes

Contents

class Admin::PagesController < ApplicationController
  before_filter :authenticate
  
  def index
    @pages = Page.order('updated_at desc')
  end

  def show
    @page = Page.find(params[:id])
  end

  def new
    @page = Page.new
  end

  def edit
    @page = Page.find(params[:id])
  end

  def create
    @page = Page.new(params[:page])

    if @page.save
      redirect_to(dashboard_path, :notice => 'Page was successfully created.')
    else
      render :action => "new"
    end
  end

  def update
    @page = Page.find(params[:id])

    if @page.update_attributes(params[:page])
      redirect_to(dashboard_path, :notice => 'Page was successfully updated.')
    else
      render :action => "edit"
    end
  end

  def destroy
    @page = Page.find(params[:id])
    @page.destroy

    redirect_to(dashboard_path, :notice => 'Page was successfully removed.')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
creature-0.0.3 lib/generators/pages/templates/admin_pages_controller.rb
creature-0.0.2 lib/generators/pages/templates/admin_pages_controller.rb
creature-0.0.1 lib/generators/pages/templates/admin_pages_controller.rb