Sha256: 6c82a7f48bc0b00c019ceb8ef1205b997bacca3394c195ea4d7cdb9c7ff773ee
Contents?: true
Size: 837 Bytes
Versions: 21
Compression:
Stored size: 837 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 def destroy @tag = Tag.find(params[:id]) @tag.destroy redirect_to tags_url, notice: 'The tag has been removed' 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
21 entries across 21 versions & 1 rubygems