class Admin::LayoutsController < ApplicationController layout "admin" def index @layouts = Layout.all end def show @layout = Layout.find(params[:id]) redirect_to "/#{@layout.name}" end def new @layout = Layout.new end def edit @layout = Layout.find(params[:id]) end def create @layout = Layout.new(params[:layout]) if @layout.save flash[:notice] = 'Layout was successfully created.' redirect_to admin_layouts_url else render :action => "new" end end def update @layout = Layout.find(params[:id]) if @layout.update_attributes(params[:layout]) flash[:notice] = 'Layout was successfully updated.' redirect_to admin_layouts_url else render :action => "edit" end end def destroy @layout = Layout.find(params[:id]) @layout.destroy redirect_to admin_layouts_url end end