Sha256: e72b953a87716d6e3f36bf2c0b256ca5ebc6efd5e008c211618b07c1e426645c
Contents?: true
Size: 1.4 KB
Versions: 9
Compression:
Stored size: 1.4 KB
Contents
module Exposition module Concerns module Controller module Admin module TagsController extend ActiveSupport::Concern def index @tags = Categorical::Tag.page(params[:page]).per(25) end def new @tag = Categorical::Tag.new end def create @tag = Categorical::Tag.new(tag_params) if @tag.save flash[:success] = "Tag successfully created." redirect_to admin_tags_path else render :new end end def edit find_tag end def update find_tag if @tag.update(tag_params) flash[:success] = "Tag was successfully updated." redirect_to admin_tags_path else render action: 'edit' end end def destroy find_tag if @tag.destroy redirect_to admin_tags_path, notice: 'Tag was successfully destroyed.' else redirect_to admin_tags_path end end private def find_tag @tag = Categorical::Tag.find_by_slug!(params[:id]) end def tag_params params.require(:tag).permit(:id, :label) end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems