Sha256: 14c87f04ae5da5497d7f13a02d9d3f283ca4fce79532f65e2a562a5b4120e72c

Contents?: true

Size: 724 Bytes

Versions: 1

Compression:

Stored size: 724 Bytes

Contents

# frozen_string_literal: true

class Comfy::Admin::Cms::CategoriesController < Comfy::Admin::Cms::BaseController
  before_action :load_category, only: %i[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!(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

1 entries across 1 versions & 1 rubygems

Version Path
comfortable_media_surfer-3.0.0 app/controllers/comfy/admin/cms/categories_controller.rb