Class: TaskTypesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/task_types_controller.rb

Instance Method Summary collapse

Methods included from SessionsHelper

#preferences_customer_type=, #preferences_customer_type?, #signed_in?, #signed_in_user, #store_location

Instance Method Details

#createObject

POST /task_types POST /task_types.json



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/controllers/task_types_controller.rb', line 44

def create
  @task_type = TaskType.new(params[:task_type])

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

#destroyObject

DELETE /task_types/1 DELETE /task_types/1.json



76
77
78
79
80
81
82
83
84
# File 'app/controllers/task_types_controller.rb', line 76

def destroy
  @task_type = TaskType.find(params[:id])
  @task_type.destroy

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

#editObject

GET /task_types/1/edit



38
39
40
# File 'app/controllers/task_types_controller.rb', line 38

def edit
  @task_type = TaskType.find(params[:id])
end

#indexObject

GET /task_types GET /task_types.json



6
7
8
9
10
11
12
13
# File 'app/controllers/task_types_controller.rb', line 6

def index
  @task_types = TaskType.all

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

#newObject

GET /task_types/new GET /task_types/new.json



28
29
30
31
32
33
34
35
# File 'app/controllers/task_types_controller.rb', line 28

def new
  @task_type = TaskType.new

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

#showObject

GET /task_types/1 GET /task_types/1.json



17
18
19
20
21
22
23
24
# File 'app/controllers/task_types_controller.rb', line 17

def show
  @task_type = TaskType.find(params[:id])

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

#updateObject

PUT /task_types/1 PUT /task_types/1.json



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'app/controllers/task_types_controller.rb', line 60

def update
  @task_type = TaskType.find(params[:id])

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