Sha256: d3bef14898275aa28abcd3c9e620425cd3309aadf906bb986f1b1958e959b99d

Contents?: true

Size: 794 Bytes

Versions: 5

Compression:

Stored size: 794 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
    logger.detailed_error($!)
    render :nothing => true
  end
  
  def update
    @category.update_attributes!(category_params)
  rescue ActiveRecord::RecordInvalid
    logger.detailed_error($!)
    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

5 entries across 5 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.11.0 app/controllers/admin/cms/categories_controller.rb
comfortable_mexican_sofa-1.10.3 app/controllers/admin/cms/categories_controller.rb
comfortable_mexican_sofa-1.10.2 app/controllers/admin/cms/categories_controller.rb
comfortable_mexican_sofa-1.10.1 app/controllers/admin/cms/categories_controller.rb
comfortable_mexican_sofa-1.10.0 app/controllers/admin/cms/categories_controller.rb