Sha256: 5293b48ce320360aa3ef9b2537002da45b3f1573a7c1b05f3784e0713abecf13
Contents?: true
Size: 1.42 KB
Versions: 5
Compression:
Stored size: 1.42 KB
Contents
class Wco::TagsController < Wco::ApplicationController before_action :set_lists, only: %i| show | def create @tag = Wco::Tag.new params[:tag].permit! authorize! :create, @tag if @tag.save flash_notice "created tag" else flash_alert "Cannot create tag: #{@tag.errors.messages}" end redirect_to action: 'index' end def destroy @tag = Wco::Tag.find params[:id] authorize! :destroy, @tag if @tag.destroy flash_notice 'ok' else flash_alert 'No luck.' end redirect_to action: 'index' end def edit @tag = Wco::Tag.find params[:id] authorize! :edit, @tag end def index authorize! :index, Wco::Tag @tags = Wco::Tag.all end def new authorize! :new, Wco::Tag @new_tag = Wco::Tag.new end def show @tag = Wco::Tag.find params[:id] authorize! :show, @tag @galleries = @tag.galleries( ).page( params[:galleries_page] ).per( current_profile.per_page ) @reports = @tag.reports( ).page( params[:reports_page] ).per( current_profile.per_page ) end def update @tag = Wco::Tag.find params[:id] authorize! :update, @tag if @tag.update params[:tag].permit! flash_notice "updated tag" else flash_alert "Cannot update tag: #{@tag.errors.messages}" end redirect_to action: 'index' end ## ## private ## private def set_lists @tags = Wco::Tag.all end end
Version data entries
5 entries across 5 versions & 1 rubygems