/
clock_ins_controller.rb
83 lines (71 loc) · 2 KB
/
clock_ins_controller.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
class ClockInsController < ApplicationController
# GET /clock_ins
# GET /clock_ins.xml
def index
@clock_ins = ClockIn.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @clock_ins }
end
end
# GET /clock_ins/1
# GET /clock_ins/1.xml
def show
@clock_in = ClockIn.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @clock_in }
end
end
# GET /clock_ins/new
# GET /clock_ins/new.xml
def new
@clock_in = ClockIn.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @clock_in }
end
end
# GET /clock_ins/1/edit
def edit
@clock_in = ClockIn.find(params[:id])
end
# POST /clock_ins
# POST /clock_ins.xml
def create
@clock_in = ClockIn.new(params[:clock_in])
respond_to do |format|
if @clock_in.save
format.html { redirect_to(@clock_in, :notice => 'Clock in was successfully created.') }
format.xml { render :xml => @clock_in, :status => :created, :location => @clock_in }
else
format.html { render :action => "new" }
format.xml { render :xml => @clock_in.errors, :status => :unprocessable_entity }
end
end
end
# PUT /clock_ins/1
# PUT /clock_ins/1.xml
def update
@clock_in = ClockIn.find(params[:id])
respond_to do |format|
if @clock_in.update_attributes(params[:clock_in])
format.html { redirect_to(@clock_in, :notice => 'Clock in was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @clock_in.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /clock_ins/1
# DELETE /clock_ins/1.xml
def destroy
@clock_in = ClockIn.find(params[:id])
@clock_in.destroy
respond_to do |format|
format.html { redirect_to(clock_ins_url) }
format.xml { head :ok }
end
end
end