-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_glossaries_controller.rb
83 lines (71 loc) · 2.11 KB
/
my_glossaries_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 MyGlossariesController < ApplicationController
# GET /my_glossaries
# GET /my_glossaries.json
def index
@my_glossaries = MyGlossary.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @my_glossaries }
end
end
# GET /my_glossaries/1
# GET /my_glossaries/1.json
def show
@my_glossary = MyGlossary.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @my_glossary }
end
end
# GET /my_glossaries/new
# GET /my_glossaries/new.json
def new
@my_glossary = MyGlossary.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @my_glossary }
end
end
# GET /my_glossaries/1/edit
def edit
@my_glossary = MyGlossary.find(params[:id])
end
# POST /my_glossaries
# POST /my_glossaries.json
def create
@my_glossary = MyGlossary.new(params[:my_glossary])
respond_to do |format|
if @my_glossary.save
format.html { redirect_to @my_glossary, notice: 'My glossary was successfully created.' }
format.json { render json: @my_glossary, status: :created, location: @my_glossary }
else
format.html { render action: "new" }
format.json { render json: @my_glossary.errors, status: :unprocessable_entity }
end
end
end
# PUT /my_glossaries/1
# PUT /my_glossaries/1.json
def update
@my_glossary = MyGlossary.find(params[:id])
respond_to do |format|
if @my_glossary.update_attributes(params[:my_glossary])
format.html { redirect_to @my_glossary, notice: 'My glossary was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @my_glossary.errors, status: :unprocessable_entity }
end
end
end
# DELETE /my_glossaries/1
# DELETE /my_glossaries/1.json
def destroy
@my_glossary = MyGlossary.find(params[:id])
@my_glossary.destroy
respond_to do |format|
format.html { redirect_to my_glossaries_url }
format.json { head :ok }
end
end
end