Sha256: 1cb86689f12f75f8064963b68deeb5561ad294de666258c94dfdcbb137e0da99

Contents?: true

Size: 1.81 KB

Versions: 7

Compression:

Stored size: 1.81 KB

Contents

class TasksController < ApplicationController
  # GET /tasks
  # GET /tasks.json
  def index
    @tasks = Task.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @tasks }
    end
  end

  # GET /tasks/1
  # GET /tasks/1.json
  def show
    @task = Task.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @task }
    end
  end

  # GET /tasks/new
  # GET /tasks/new.json
  def new
    @task = Task.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @task }
    end
  end

  # GET /tasks/1/edit
  def edit
    @task = Task.find(params[:id])
  end

  # POST /tasks
  # POST /tasks.json
  def create
    @task = Task.new(params[:task])

    respond_to do |format|
      if @task.save
        format.html { redirect_to @task, notice: 'Task was successfully created.' }
        format.json { render json: @task, status: :created, location: @task }
      else
        format.html { render action: "new" }
        format.json { render json: @task.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /tasks/1
  # PUT /tasks/1.json
  def update
    @task = Task.find(params[:id])

    respond_to do |format|
      if @task.update_attributes(params[:task])
        format.html { redirect_to @task, notice: 'Task was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @task.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /tasks/1
  # DELETE /tasks/1.json
  def destroy
    @task = Task.find(params[:id])
    @task.destroy

    respond_to do |format|
      format.html { redirect_to tasks_url }
      format.json { head :no_content }
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
rack-allocation_stats-0.1.1 ./demo_rack_apps/Rails_3.2.15/app/controllers/tasks_controller.rb
rack-allocation_stats-0.1.0 ./demo_rack_apps/Rails_3.2.15/app/controllers/tasks_controller.rb
jquery_dynamic_fields-0.0.4 spec/dummy/app/controllers/tasks_controller.rb
railstar-0.0.9 test/dummy/app/controllers/tasks_controller.rb
railstar-0.0.8 test/dummy/app/controllers/tasks_controller.rb
railstar-0.0.7 test/dummy/app/controllers/tasks_controller.rb
railstar-0.0.6 test/dummy/app/controllers/tasks_controller.rb