Sha256: a204f4cc1eb3d36084c4cf3889b9f9c5c95d76262cf863884269c63dbb532c3e

Contents?: true

Size: 1.09 KB

Versions: 89

Compression:

Stored size: 1.09 KB

Contents

class Wco::TagsController < Wco::ApplicationController

  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
  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

end

Version data entries

89 entries across 89 versions & 1 rubygems

Version Path
wco_models-3.1.0.128 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.127 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.126 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.125 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.124 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.123 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.122 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.121 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.120 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.119 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.118 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.117 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.116 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.115 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.114 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.113 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.112 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.111 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.110 app/controllers/wco/tags_controller.rb
wco_models-3.1.0.109 app/controllers/wco/tags_controller.rb