Sha256: f1362d54f209407b774e5a775e5c4075c4872db2643b1181eb63c876f54e342e
Contents?: true
Size: 1.37 KB
Versions: 6
Compression:
Stored size: 1.37 KB
Contents
class Forge::PostCategoriesController < ForgeController load_and_authorize_resource def index @post_category = PostCategory.new respond_to do |format| format.html { get_post_categories } format.js { params[:q] ||= '' @post_categories = PostCategory.where("LOWER(title) LIKE ?", "%#{params[:q].downcase}%") @post_categories = @post_categories.order(:title) render :partial => "post_category", :collection => @post_categories } end end def edit respond_to do |format| format.js { render :layout => false } format.html { } end end def create @post_category = PostCategory.new(params[:post_category]) if @post_category.save flash[:notice] = 'Post category was successfully created.' redirect_to(forge_post_categories_path) else get_post_categories render :action => "index" end end def update if @post_category.update_attributes(params[:post_category]) flash[:notice] = 'Post category was successfully updated.' redirect_to(forge_post_categories_path) else render :action => "edit" end end def destroy @post_category.destroy redirect_to(forge_post_categories_path) end private def get_post_categories @post_categories = PostCategory.order(:title).paginate(:per_page => 10, :page => params[:page]) end end
Version data entries
6 entries across 6 versions & 1 rubygems