Sha256: 70c00edd966c4557fe47411d3d65fd863ec9d35eb06d1e6548c06e8037298dd6

Contents?: true

Size: 748 Bytes

Versions: 3

Compression:

Stored size: 748 Bytes

Contents

class Comfy::Admin::Cms::CategoriesController < Comfy::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

3 entries across 3 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.12.2 app/controllers/comfy/admin/cms/categories_controller.rb
comfortable_mexican_sofa-1.12.1 app/controllers/comfy/admin/cms/categories_controller.rb
comfortable_mexican_sofa-1.12.0 app/controllers/comfy/admin/cms/categories_controller.rb