Sha256: 78a7925a6546bb72313a0a6d1f261976302aa573fcd22f085af0311f60c576f1

Contents?: true

Size: 705 Bytes

Versions: 2

Compression:

Stored size: 705 Bytes

Contents

class TagsController < ApplicationController

  before_filter :authenticate
  before_filter :authenticate_with_admin

  def index
    @tags = Tag.alphabetically
    switch_to_admin_layout
  end

  def edit
    @tag = Tag.find(params[:id])
    switch_to_admin_layout
  end

  def update
    @tag = Tag.find(params[:id])
    if @tag.update_attributes(tag_params)
      redirect_to tags_path, notice: t('tags.update.notice')
    else
      flash[:warning] = t('tags.update.warning')
      render action: "edit", layout: 'admin'
    end
  end

  private

  # Never trust parameters from the scary internet, only allow the white list through.
  def tag_params
    params.require(:tag).permit(:name)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tkh_content-0.9.11 app/controllers/tags_controller.rb
tkh_content-0.9.10 app/controllers/tags_controller.rb