Sha256: f9f3edc4ebd5553006d3ad52a6aa8e7d2d16422407fc03ed9d0261162e7c2b10

Contents?: true

Size: 708 Bytes

Versions: 3

Compression:

Stored size: 708 Bytes

Contents

class Comfy::Admin::Cms::CategoriesController < Comfy::Admin::Cms::BaseController

  before_action :load_category, only: [:edit, :update, :destroy]
  before_action :authorize

  def edit
    render
  end

  def create
    @category = @site.categories.create!(category_params)
  rescue ActiveRecord::RecordInvalid
    head :ok
  end

  def update
    @category.update_attributes!(category_params)
  rescue ActiveRecord::RecordInvalid
    head :ok
  end

  def destroy
    @category.destroy
  end

protected

  def load_category
    @category = @site.categories.find(params[:id])
  rescue ActiveRecord::RecordNotFound
    head :ok
  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-2.0.2 app/controllers/comfy/admin/cms/categories_controller.rb
comfortable_mexican_sofa-2.0.1 app/controllers/comfy/admin/cms/categories_controller.rb
comfortable_mexican_sofa-2.0.0 app/controllers/comfy/admin/cms/categories_controller.rb