dynamic_controller 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -4
- data/Gemfile +4 -4
- data/README.md +39 -2
- data/Rakefile +1 -1
- data/dynamic_controller.gemspec +26 -26
- data/lib/dynamic_controller/class_methods.rb +48 -0
- data/lib/dynamic_controller/helper_methods.rb +59 -0
- data/lib/dynamic_controller/instance_methods.rb +127 -0
- data/lib/dynamic_controller/resource.rb +21 -0
- data/lib/dynamic_controller/responder.rb +71 -0
- data/lib/dynamic_controller/version.rb +3 -3
- data/lib/dynamic_controller.rb +12 -180
- data/spec/controller_factory.rb +15 -0
- data/spec/controllers/crud_actions_json_spec.rb +3 -3
- data/spec/controllers/nested_crud_actions_html_spec.rb +9 -8
- data/spec/controllers/nested_crud_actions_json_spec.rb +11 -11
- data/spec/controllers/redefined_responders_html_spec.rb +112 -0
- data/spec/controllers/redefined_responders_json_spec.rb +95 -0
- data/spec/controllers/two_level_nested_crud_actions_html_spec.rb +134 -0
- data/spec/controllers/two_level_nested_crud_actions_json_spec.rb +98 -0
- data/spec/dummy/.gitignore +15 -15
- data/spec/dummy/Gemfile +12 -12
- data/spec/dummy/README.rdoc +261 -261
- data/spec/dummy/Rakefile +7 -7
- data/spec/dummy/app/assets/javascripts/application.js +15 -15
- data/spec/dummy/app/assets/stylesheets/application.css +13 -13
- data/spec/dummy/app/assets/stylesheets/scaffolds.css.scss +69 -69
- data/spec/dummy/app/controllers/application_controller.rb +3 -3
- data/spec/dummy/app/controllers/cities_controller.rb +95 -94
- data/spec/dummy/app/controllers/countries_controller.rb +86 -86
- data/spec/dummy/app/controllers/languages_controller.rb +95 -0
- data/spec/dummy/app/controllers/streets_controller.rb +97 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -2
- data/spec/dummy/app/models/city.rb +6 -5
- data/spec/dummy/app/models/country.rb +5 -5
- data/spec/dummy/app/models/language.rb +4 -0
- data/spec/dummy/app/models/street.rb +5 -0
- data/spec/dummy/app/views/cities/_form.html.erb +25 -25
- data/spec/dummy/app/views/cities/edit.html.erb +6 -6
- data/spec/dummy/app/views/cities/index.html.erb +29 -25
- data/spec/dummy/app/views/cities/new.html.erb +5 -5
- data/spec/dummy/app/views/cities/show.html.erb +15 -15
- data/spec/dummy/app/views/countries/_form.html.erb +21 -21
- data/spec/dummy/app/views/countries/edit.html.erb +6 -6
- data/spec/dummy/app/views/countries/index.html.erb +25 -23
- data/spec/dummy/app/views/countries/new.html.erb +5 -5
- data/spec/dummy/app/views/countries/show.html.erb +10 -10
- data/spec/dummy/app/views/languages/_form.html.erb +21 -0
- data/spec/dummy/app/views/languages/edit.html.erb +6 -0
- data/spec/dummy/app/views/languages/index.html.erb +23 -0
- data/spec/dummy/app/views/languages/new.html.erb +5 -0
- data/spec/dummy/app/views/languages/show.html.erb +10 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -14
- data/spec/dummy/app/views/streets/_form.html.erb +25 -0
- data/spec/dummy/app/views/streets/edit.html.erb +6 -0
- data/spec/dummy/app/views/streets/index.html.erb +27 -0
- data/spec/dummy/app/views/streets/new.html.erb +5 -0
- data/spec/dummy/app/views/streets/show.html.erb +15 -0
- data/spec/dummy/config/application.rb +62 -62
- data/spec/dummy/config/boot.rb +6 -6
- data/spec/dummy/config/database.yml +25 -25
- data/spec/dummy/config/environment.rb +5 -5
- data/spec/dummy/config/environments/development.rb +37 -37
- data/spec/dummy/config/environments/production.rb +67 -67
- data/spec/dummy/config/environments/test.rb +37 -37
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
- data/spec/dummy/config/initializers/inflections.rb +15 -15
- data/spec/dummy/config/initializers/mime_types.rb +5 -5
- data/spec/dummy/config/initializers/secret_token.rb +7 -7
- data/spec/dummy/config/initializers/session_store.rb +8 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
- data/spec/dummy/config/locales/en.yml +5 -5
- data/spec/dummy/config/routes.rb +8 -5
- data/spec/dummy/config.ru +4 -4
- data/spec/dummy/db/migrate/20120907174827_create_countries.rb +9 -9
- data/spec/dummy/db/migrate/20120907230842_create_cities.rb +11 -11
- data/spec/dummy/db/migrate/20120922010743_create_languages.rb +9 -0
- data/spec/dummy/db/migrate/20120929185302_create_streets.rb +11 -0
- data/spec/dummy/db/schema.rb +16 -1
- data/spec/dummy/db/seeds.rb +7 -7
- data/spec/dummy/doc/README_FOR_APP +2 -2
- data/spec/dummy/public/404.html +26 -26
- data/spec/dummy/public/422.html +26 -26
- data/spec/dummy/public/500.html +25 -25
- data/spec/dummy/public/index.html +241 -241
- data/spec/dummy/public/robots.txt +5 -5
- data/spec/dummy/script/rails +6 -6
- data/spec/factories.rb +9 -0
- data/spec/has_crud_actions_options_spec.rb +49 -0
- data/spec/spec_helper.rb +1 -0
- metadata +43 -16
@@ -1,69 +1,69 @@
|
|
1
|
-
body {
|
2
|
-
background-color: #fff;
|
3
|
-
color: #333;
|
4
|
-
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
-
font-size: 13px;
|
6
|
-
line-height: 18px;
|
7
|
-
}
|
8
|
-
|
9
|
-
p, ol, ul, td {
|
10
|
-
font-family: verdana, arial, helvetica, sans-serif;
|
11
|
-
font-size: 13px;
|
12
|
-
line-height: 18px;
|
13
|
-
}
|
14
|
-
|
15
|
-
pre {
|
16
|
-
background-color: #eee;
|
17
|
-
padding: 10px;
|
18
|
-
font-size: 11px;
|
19
|
-
}
|
20
|
-
|
21
|
-
a {
|
22
|
-
color: #000;
|
23
|
-
&:visited {
|
24
|
-
color: #666;
|
25
|
-
}
|
26
|
-
&:hover {
|
27
|
-
color: #fff;
|
28
|
-
background-color: #000;
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
div {
|
33
|
-
&.field, &.actions {
|
34
|
-
margin-bottom: 10px;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
#notice {
|
39
|
-
color: green;
|
40
|
-
}
|
41
|
-
|
42
|
-
.field_with_errors {
|
43
|
-
padding: 2px;
|
44
|
-
background-color: red;
|
45
|
-
display: table;
|
46
|
-
}
|
47
|
-
|
48
|
-
#error_explanation {
|
49
|
-
width: 450px;
|
50
|
-
border: 2px solid red;
|
51
|
-
padding: 7px;
|
52
|
-
padding-bottom: 0;
|
53
|
-
margin-bottom: 20px;
|
54
|
-
background-color: #f0f0f0;
|
55
|
-
h2 {
|
56
|
-
text-align: left;
|
57
|
-
font-weight: bold;
|
58
|
-
padding: 5px 5px 5px 15px;
|
59
|
-
font-size: 12px;
|
60
|
-
margin: -7px;
|
61
|
-
margin-bottom: 0px;
|
62
|
-
background-color: #c00;
|
63
|
-
color: #fff;
|
64
|
-
}
|
65
|
-
ul li {
|
66
|
-
font-size: 12px;
|
67
|
-
list-style: square;
|
68
|
-
}
|
69
|
-
}
|
1
|
+
body {
|
2
|
+
background-color: #fff;
|
3
|
+
color: #333;
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
p, ol, ul, td {
|
10
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
11
|
+
font-size: 13px;
|
12
|
+
line-height: 18px;
|
13
|
+
}
|
14
|
+
|
15
|
+
pre {
|
16
|
+
background-color: #eee;
|
17
|
+
padding: 10px;
|
18
|
+
font-size: 11px;
|
19
|
+
}
|
20
|
+
|
21
|
+
a {
|
22
|
+
color: #000;
|
23
|
+
&:visited {
|
24
|
+
color: #666;
|
25
|
+
}
|
26
|
+
&:hover {
|
27
|
+
color: #fff;
|
28
|
+
background-color: #000;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
div {
|
33
|
+
&.field, &.actions {
|
34
|
+
margin-bottom: 10px;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
#notice {
|
39
|
+
color: green;
|
40
|
+
}
|
41
|
+
|
42
|
+
.field_with_errors {
|
43
|
+
padding: 2px;
|
44
|
+
background-color: red;
|
45
|
+
display: table;
|
46
|
+
}
|
47
|
+
|
48
|
+
#error_explanation {
|
49
|
+
width: 450px;
|
50
|
+
border: 2px solid red;
|
51
|
+
padding: 7px;
|
52
|
+
padding-bottom: 0;
|
53
|
+
margin-bottom: 20px;
|
54
|
+
background-color: #f0f0f0;
|
55
|
+
h2 {
|
56
|
+
text-align: left;
|
57
|
+
font-weight: bold;
|
58
|
+
padding: 5px 5px 5px 15px;
|
59
|
+
font-size: 12px;
|
60
|
+
margin: -7px;
|
61
|
+
margin-bottom: 0px;
|
62
|
+
background-color: #c00;
|
63
|
+
color: #fff;
|
64
|
+
}
|
65
|
+
ul li {
|
66
|
+
font-size: 12px;
|
67
|
+
list-style: square;
|
68
|
+
}
|
69
|
+
}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
class ApplicationController < ActionController::Base
|
2
|
-
protect_from_forgery
|
3
|
-
end
|
1
|
+
class ApplicationController < ActionController::Base
|
2
|
+
protect_from_forgery
|
3
|
+
end
|
@@ -1,94 +1,95 @@
|
|
1
|
-
class CitiesController < ApplicationController
|
2
|
-
has_crud_actions
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
# GET /cities
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
format.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# GET /cities/1
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
format.
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
# GET /cities/new
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
format.
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
# POST /cities
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
format.
|
53
|
-
|
54
|
-
|
55
|
-
format.
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
# PUT /cities/1
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
format.
|
69
|
-
|
70
|
-
|
71
|
-
format.
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
# DELETE /cities/1
|
78
|
-
|
79
|
-
|
80
|
-
@city.
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
format.
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
1
|
+
class CitiesController < ApplicationController
|
2
|
+
has_crud_actions
|
3
|
+
nested_of Country
|
4
|
+
=begin
|
5
|
+
before_filter :load_nested
|
6
|
+
|
7
|
+
# GET /cities
|
8
|
+
# GET /cities.json
|
9
|
+
def index
|
10
|
+
@cities = @country.cities
|
11
|
+
|
12
|
+
respond_to do |format|
|
13
|
+
format.html # index.html.erb
|
14
|
+
format.json { render json: @cities }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# GET /cities/1
|
19
|
+
# GET /cities/1.json
|
20
|
+
def show
|
21
|
+
@city = @country.cities.find(params[:id])
|
22
|
+
|
23
|
+
respond_to do |format|
|
24
|
+
format.html # show.html.erb
|
25
|
+
format.json { render json: @city }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# GET /cities/new
|
30
|
+
# GET /cities/new.json
|
31
|
+
def new
|
32
|
+
@city = @country.cities.build
|
33
|
+
|
34
|
+
respond_to do |format|
|
35
|
+
format.html # new.html.erb
|
36
|
+
format.json { render json: @city }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# GET /cities/1/edit
|
41
|
+
def edit
|
42
|
+
@city = @country.cities.find(params[:id])
|
43
|
+
end
|
44
|
+
|
45
|
+
# POST /cities
|
46
|
+
# POST /cities.json
|
47
|
+
def create
|
48
|
+
@city = @country.cities.build(params[:city])
|
49
|
+
|
50
|
+
respond_to do |format|
|
51
|
+
if @city.save
|
52
|
+
format.html { redirect_to [@country, @city], notice: 'City was successfully created.' }
|
53
|
+
format.json { render json: @city, status: :created }
|
54
|
+
else
|
55
|
+
format.html { render action: "new" }
|
56
|
+
format.json { render json: @city.errors, status: :unprocessable_entity }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# PUT /cities/1
|
62
|
+
# PUT /cities/1.json
|
63
|
+
def update
|
64
|
+
@city = @country.cities.find(params[:id])
|
65
|
+
|
66
|
+
respond_to do |format|
|
67
|
+
if @city.update_attributes(params[:city])
|
68
|
+
format.html { redirect_to [@country, @city], notice: 'City was successfully updated.' }
|
69
|
+
format.json { head :no_content }
|
70
|
+
else
|
71
|
+
format.html { render action: "edit" }
|
72
|
+
format.json { render json: @city.errors, status: :unprocessable_entity }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# DELETE /cities/1
|
78
|
+
# DELETE /cities/1.json
|
79
|
+
def destroy
|
80
|
+
@city = @country.cities.find(params[:id])
|
81
|
+
@city.destroy
|
82
|
+
|
83
|
+
respond_to do |format|
|
84
|
+
format.html { redirect_to country_cities_url(@country) }
|
85
|
+
format.json { head :no_content }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def load_nested
|
92
|
+
@country = Country.find(params[:country_id])
|
93
|
+
end
|
94
|
+
=end
|
95
|
+
end
|
@@ -1,86 +1,86 @@
|
|
1
|
-
class CountriesController < ApplicationController
|
2
|
-
has_crud_actions
|
3
|
-
=begin
|
4
|
-
# GET /countries
|
5
|
-
# GET /countries.json
|
6
|
-
def index
|
7
|
-
@countries = Country.all
|
8
|
-
|
9
|
-
respond_to do |format|
|
10
|
-
format.html # index.html.erb
|
11
|
-
format.json { render json: @countries }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# GET /countries/1
|
16
|
-
# GET /countries/1.json
|
17
|
-
def show
|
18
|
-
@country = Country.find(params[:id])
|
19
|
-
|
20
|
-
respond_to do |format|
|
21
|
-
format.html # show.html.erb
|
22
|
-
format.json { render json: @country }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# GET /countries/new
|
27
|
-
# GET /countries/new.json
|
28
|
-
def new
|
29
|
-
@country = Country.new
|
30
|
-
|
31
|
-
respond_to do |format|
|
32
|
-
format.html # new.html.erb
|
33
|
-
format.json { render json: @country }
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# GET /countries/1/edit
|
38
|
-
def edit
|
39
|
-
@country = Country.find(params[:id])
|
40
|
-
end
|
41
|
-
|
42
|
-
# POST /countries
|
43
|
-
# POST /countries.json
|
44
|
-
def create
|
45
|
-
@country = Country.new(params[:country])
|
46
|
-
|
47
|
-
respond_to do |format|
|
48
|
-
if @country.save
|
49
|
-
format.html { redirect_to @country, notice: 'Country was successfully created.' }
|
50
|
-
format.json { render json: @country, status: :created, location: @country }
|
51
|
-
else
|
52
|
-
format.html { render action: "new" }
|
53
|
-
format.json { render json: @country.errors, status: :unprocessable_entity }
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
# PUT /countries/1
|
59
|
-
# PUT /countries/1.json
|
60
|
-
def update
|
61
|
-
@country = Country.find(params[:id])
|
62
|
-
|
63
|
-
respond_to do |format|
|
64
|
-
if @country.update_attributes(params[:country])
|
65
|
-
format.html { redirect_to @country, notice: 'Country was successfully updated.' }
|
66
|
-
format.json { head :no_content }
|
67
|
-
else
|
68
|
-
format.html { render action: "edit" }
|
69
|
-
format.json { render json: @country.errors, status: :unprocessable_entity }
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# DELETE /countries/1
|
75
|
-
# DELETE /countries/1.json
|
76
|
-
def destroy
|
77
|
-
@country = Country.find(params[:id])
|
78
|
-
@country.destroy
|
79
|
-
|
80
|
-
respond_to do |format|
|
81
|
-
format.html { redirect_to countries_url }
|
82
|
-
format.json { head :no_content }
|
83
|
-
end
|
84
|
-
end
|
85
|
-
=end
|
86
|
-
end
|
1
|
+
class CountriesController < ApplicationController
|
2
|
+
has_crud_actions
|
3
|
+
=begin
|
4
|
+
# GET /countries
|
5
|
+
# GET /countries.json
|
6
|
+
def index
|
7
|
+
@countries = Country.all
|
8
|
+
|
9
|
+
respond_to do |format|
|
10
|
+
format.html # index.html.erb
|
11
|
+
format.json { render json: @countries }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /countries/1
|
16
|
+
# GET /countries/1.json
|
17
|
+
def show
|
18
|
+
@country = Country.find(params[:id])
|
19
|
+
|
20
|
+
respond_to do |format|
|
21
|
+
format.html # show.html.erb
|
22
|
+
format.json { render json: @country }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# GET /countries/new
|
27
|
+
# GET /countries/new.json
|
28
|
+
def new
|
29
|
+
@country = Country.new
|
30
|
+
|
31
|
+
respond_to do |format|
|
32
|
+
format.html # new.html.erb
|
33
|
+
format.json { render json: @country }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# GET /countries/1/edit
|
38
|
+
def edit
|
39
|
+
@country = Country.find(params[:id])
|
40
|
+
end
|
41
|
+
|
42
|
+
# POST /countries
|
43
|
+
# POST /countries.json
|
44
|
+
def create
|
45
|
+
@country = Country.new(params[:country])
|
46
|
+
|
47
|
+
respond_to do |format|
|
48
|
+
if @country.save
|
49
|
+
format.html { redirect_to @country, notice: 'Country was successfully created.' }
|
50
|
+
format.json { render json: @country, status: :created, location: @country }
|
51
|
+
else
|
52
|
+
format.html { render action: "new" }
|
53
|
+
format.json { render json: @country.errors, status: :unprocessable_entity }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# PUT /countries/1
|
59
|
+
# PUT /countries/1.json
|
60
|
+
def update
|
61
|
+
@country = Country.find(params[:id])
|
62
|
+
|
63
|
+
respond_to do |format|
|
64
|
+
if @country.update_attributes(params[:country])
|
65
|
+
format.html { redirect_to @country, notice: 'Country was successfully updated.' }
|
66
|
+
format.json { head :no_content }
|
67
|
+
else
|
68
|
+
format.html { render action: "edit" }
|
69
|
+
format.json { render json: @country.errors, status: :unprocessable_entity }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# DELETE /countries/1
|
75
|
+
# DELETE /countries/1.json
|
76
|
+
def destroy
|
77
|
+
@country = Country.find(params[:id])
|
78
|
+
@country.destroy
|
79
|
+
|
80
|
+
respond_to do |format|
|
81
|
+
format.html { redirect_to countries_url }
|
82
|
+
format.json { head :no_content }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
=end
|
86
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
class LanguagesController < ApplicationController
|
2
|
+
has_crud_actions
|
3
|
+
|
4
|
+
respond_to_create :html do
|
5
|
+
redirect_to action: :index
|
6
|
+
end
|
7
|
+
|
8
|
+
respond_to_update do |format|
|
9
|
+
format.html { redirect_to action: :index }
|
10
|
+
format.json { render json: @language }
|
11
|
+
end
|
12
|
+
=begin
|
13
|
+
# GET /languages
|
14
|
+
# GET /languages.json
|
15
|
+
def index
|
16
|
+
@languages = Language.all
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # index.html.erb
|
20
|
+
format.json { render json: @languages }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /languages/1
|
25
|
+
# GET /languages/1.json
|
26
|
+
def show
|
27
|
+
@language = Language.find(params[:id])
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # show.html.erb
|
31
|
+
format.json { render json: @language }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /languages/new
|
36
|
+
# GET /languages/new.json
|
37
|
+
def new
|
38
|
+
@language = Language.new
|
39
|
+
|
40
|
+
respond_to do |format|
|
41
|
+
format.html # new.html.erb
|
42
|
+
format.json { render json: @language }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# GET /languages/1/edit
|
47
|
+
def edit
|
48
|
+
@language = Language.find(params[:id])
|
49
|
+
end
|
50
|
+
|
51
|
+
# POST /languages
|
52
|
+
# POST /languages.json
|
53
|
+
def create
|
54
|
+
@language = Language.new(params[:language])
|
55
|
+
|
56
|
+
respond_to do |format|
|
57
|
+
if @language.save
|
58
|
+
format.html { redirect_to action: :index, notice: 'Language was successfully created.' }
|
59
|
+
format.json { render json: @language, status: :created, location: @language }
|
60
|
+
else
|
61
|
+
format.html { render action: "new" }
|
62
|
+
format.json { render json: @language.errors, status: :unprocessable_entity }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# PUT /languages/1
|
68
|
+
# PUT /languages/1.json
|
69
|
+
def update
|
70
|
+
@language = Language.find(params[:id])
|
71
|
+
|
72
|
+
respond_to do |format|
|
73
|
+
if @language.update_attributes(params[:language])
|
74
|
+
format.html { redirect_to action: :index, notice: 'Language was successfully updated.' }
|
75
|
+
format.json { head :no_content }
|
76
|
+
else
|
77
|
+
format.html { render action: "edit" }
|
78
|
+
format.json { render json: @language.errors, status: :unprocessable_entity }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# DELETE /languages/1
|
84
|
+
# DELETE /languages/1.json
|
85
|
+
def destroy
|
86
|
+
@language = Language.find(params[:id])
|
87
|
+
@language.destroy
|
88
|
+
|
89
|
+
respond_to do |format|
|
90
|
+
format.html { redirect_to languages_url }
|
91
|
+
format.json { head :no_content }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
=end
|
95
|
+
end
|