Sha256: 604a6b632d86c6020978c0eae8b7e579b2206c11f540725d88cc473c62ea05da
Contents?: true
Size: 1.29 KB
Versions: 33
Compression:
Stored size: 1.29 KB
Contents
class Admin::BlogCategoriesController < ApplicationController before_filter :authenticate_user! if Object.const_defined?('Devise') before_filter :find_blog_category, :only => [:destroy, :edit, :update, :show] def index @blog_categories = BlogCategory.roots end def show end def new @blog_category = BlogCategory.new :parent_id => params[:parent_id] end def create @blog_category = BlogCategory.new params[:blog_category] if @blog_category.save flash[:notice] = 'Successfully created the blog_category.' redirect_to @blog_category.root? ? admin_blog_category_path(@blog_category) : admin_blog_category_path(@blog_category.parent) else render :action => 'new' end end def edit end def update if @blog_category.update_attributes params[:blog_category] flash[:notice] = 'Successfully updated the blog_category.' redirect_to admin_blog_categories_path else render :action => 'edit' end end def destroy @blog_category.destroy flash[:notice] = 'Successfully destroyed the blog_category.' redirect_to @blog_category.root? ? admin_blog_categories_path : admin_blog_category_path(@blog_category.parent) end private def find_blog_category @blog_category = BlogCategory.find params[:id] end end
Version data entries
33 entries across 33 versions & 1 rubygems