Sha256: b54dbaba73d6f41ae5b1c9bc96a85f7deb17509817e98855f169869ca2da3f3a

Contents?: true

Size: 1.99 KB

Versions: 13

Compression:

Stored size: 1.99 KB

Contents

module Kaui
  class TagsController < ApplicationController
    # GET /tags
    # GET /tags.json
    def index
      @tags = Tag.all
  
      respond_to do |format|
        format.html # index.html.erb
        format.json { render :json => @tags }
      end
    end
  
    # GET /tags/1
    # GET /tags/1.json
    def show
      @tag = Tag.find(params[:id])
  
      respond_to do |format|
        format.html # show.html.erb
        format.json { render :json => @tag }
      end
    end
  
    # GET /tags/new
    # GET /tags/new.json
    def new
      @tag = Tag.new
  
      respond_to do |format|
        format.html # new.html.erb
        format.json { render :json => @tag }
      end
    end
  
    # GET /tags/1/edit
    def edit
      @tag = Tag.find(params[:id])
    end
  
    # POST /tags
    # POST /tags.json
    def create
      @tag = Tag.new(params[:tag])
  
      respond_to do |format|
        if @tag.save
          format.html { redirect_to @tag, :notice => 'Tag was successfully created.' }
          format.json { render :json => @tag, :status => :created, :location => @tag }
        else
          format.html { render :action => "new" }
          format.json { render :json => @tag.errors, :status => :unprocessable_entity }
        end
      end
    end
  
    # PUT /tags/1
    # PUT /tags/1.json
    def update
      @tag = Tag.find(params[:id])
  
      respond_to do |format|
        if @tag.update_attributes(params[:tag])
          format.html { redirect_to @tag, :notice => 'Tag was successfully updated.' }
          format.json { head :no_content }
        else
          format.html { render :action => "edit" }
          format.json { render :json => @tag.errors, :status => :unprocessable_entity }
        end
      end
    end
  
    # DELETE /tags/1
    # DELETE /tags/1.json
    def destroy
      @tag = Tag.find(params[:id])
      @tag.destroy
  
      respond_to do |format|
        format.html { redirect_to tags_url }
        format.json { head :no_content }
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
kaui-0.1.18 app/controllers/kaui/tags_controller.rb
kaui-0.1.16 app/controllers/kaui/tags_controller.rb
kaui-0.1.15 app/controllers/kaui/tags_controller.rb
kaui-0.1.14 app/controllers/kaui/tags_controller.rb
kaui-0.1.12 app/controllers/kaui/tags_controller.rb
kaui-0.1.11 app/controllers/kaui/tags_controller.rb
kaui-0.1.10 app/controllers/kaui/tags_controller.rb
kaui-0.1.9 app/controllers/kaui/tags_controller.rb
kaui-0.1.7 app/controllers/kaui/tags_controller.rb
kaui-0.1.6 app/controllers/kaui/tags_controller.rb
kaui-0.1.5 app/controllers/kaui/tags_controller.rb
kaui-0.1.4 app/controllers/kaui/tags_controller.rb
kaui-0.1.3 app/controllers/kaui/tags_controller.rb