Sha256: b8b5df9cd9501ab4cecfe0e6413c0dac6a12d00e6c9c6693ba1b4edaa302739c
Contents?: true
Size: 1.02 KB
Versions: 5
Compression:
Stored size: 1.02 KB
Contents
require_dependency "cas/application_controller" module Cas class Sites::Sections::CategoriesController < Sites::Sections::ApplicationController before_action :set_category, only: [:edit, :update, :destroy] def index @categories = @section.categories end def new @category = ::Cas::Category.new end def edit end def create @category = ::Cas::Category.new(category_params) @category.section = @section if @category.save redirect_to site_section_categories_url(@site, @section), notice: 'Categoria salva com sucesso.' else render :new end end def update if @category.update(category_params) redirect_to site_section_categories_url(@site, @section), notice: 'Categoria salva com sucesso.' else render :edit end end private def set_category @category = ::Cas::Category.find(params[:id]) end def category_params params.require(:category).permit(:name) end end end
Version data entries
5 entries across 5 versions & 1 rubygems