Sha256: 301743d49beab453f538e28b2a0e5d45e546dc36529c640604fa49604ada1501

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 Bytes

Contents

class Admin::Cms::CategoriesController < Admin::Cms::BaseController
  
  before_action :load_category,  :only => [:edit, :update, :destroy]
  
  def edit
    render
  end
  
  def create
    @category = @site.categories.create!(category_params)
  rescue ActiveRecord::RecordInvalid
    render :nothing => true
  end
  
  def update
    @category.update_attributes!(category_params)
  rescue ActiveRecord::RecordInvalid
    render :nothing => true
  end
  
  def destroy
    @category.destroy
  end
  
protected
  
  def load_category
    @category = @site.categories.find(params[:id])
  rescue ActiveRecord::RecordNotFound
    render :nothing => true
  end
  
  def category_params
    params.fetch(:category, {}).permit!
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.11.2 app/controllers/admin/cms/categories_controller.rb
comfortable_mexican_sofa-1.11.1 app/controllers/admin/cms/categories_controller.rb