Sha256: 78338c66bf86cb11179790fc2c011408dd8fe77754ac3da08038232e2b63776c
Contents?: true
Size: 1.4 KB
Versions: 1
Compression:
Stored size: 1.4 KB
Contents
module HyperKittenMeow module Concerns module Controllers module Admin module TagsController extend ActiveSupport::Concern def index @pagy, @tags = pagy(Categorical::Tag.all) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hyper-kitten-meow-0.1.2 | lib/hyper_kitten_meow/concerns/controllers/admin/tags_controller.rb |