routespec 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +66 -0
- data/Rakefile +26 -0
- data/bin/routespec +29 -0
- data/lib/routespec.rb +22 -0
- data/lib/routespec/builder.rb +111 -0
- data/lib/routespec/dyr.rb +50 -0
- data/lib/routespec/fyle.rb +72 -0
- data/lib/routespec/parser.rb +143 -0
- data/lib/routespec/railtie.rb +7 -0
- data/lib/routespec/routespec/requests/.gitkeep +0 -0
- data/lib/routespec/routespec/support/.gitkeep +0 -0
- data/lib/routespec/routespec/templates/default_spec.erb +24 -0
- data/lib/routespec/tasks.rb +18 -0
- data/lib/routespec/tasks/routespec.rake +22 -0
- data/lib/routespec/template_vars.rb +7 -0
- data/lib/routespec/version.rb +3 -0
- data/test/files/awesome.yml +1 -0
- data/test/files/response_code_vcr_spec.erb +24 -0
- data/test/files/routes.txt +12 -0
- data/test/files/routes.yml +193 -0
- data/test/files/routes_hash.rb +159 -0
- data/test/files/routes_hash_2.rb +153 -0
- data/test/files/routes_hash_3.rb +1 -0
- data/test/files/tasks_routes.txt +21 -0
- data/test/files/template_spec.erb +13 -0
- data/test/files/unclean.txt +11 -0
- data/test/rails311/Gemfile +4 -0
- data/test/rails311/Gemfile.lock +90 -0
- data/test/rails311/README +261 -0
- data/test/rails311/Rakefile +7 -0
- data/test/rails311/app/assets/images/rails.png +0 -0
- data/test/rails311/app/assets/javascripts/application.js +9 -0
- data/test/rails311/app/assets/javascripts/beers.js +2 -0
- data/test/rails311/app/assets/javascripts/chips.js +2 -0
- data/test/rails311/app/assets/javascripts/sports.js +2 -0
- data/test/rails311/app/assets/stylesheets/application.css +7 -0
- data/test/rails311/app/assets/stylesheets/beers.css +4 -0
- data/test/rails311/app/assets/stylesheets/chips.css +4 -0
- data/test/rails311/app/assets/stylesheets/scaffold.css +56 -0
- data/test/rails311/app/assets/stylesheets/sports.css +4 -0
- data/test/rails311/app/controllers/application_controller.rb +3 -0
- data/test/rails311/app/controllers/beers_controller.rb +83 -0
- data/test/rails311/app/controllers/chips_controller.rb +83 -0
- data/test/rails311/app/controllers/sports_controller.rb +83 -0
- data/test/rails311/app/helpers/application_helper.rb +2 -0
- data/test/rails311/app/helpers/beers_helper.rb +2 -0
- data/test/rails311/app/helpers/chips_helper.rb +2 -0
- data/test/rails311/app/helpers/sports_helper.rb +2 -0
- data/test/rails311/app/models/beer.rb +2 -0
- data/test/rails311/app/models/chip.rb +2 -0
- data/test/rails311/app/models/sport.rb +2 -0
- data/test/rails311/app/views/beers/_form.html.erb +17 -0
- data/test/rails311/app/views/beers/edit.html.erb +6 -0
- data/test/rails311/app/views/beers/index.html.erb +21 -0
- data/test/rails311/app/views/beers/new.html.erb +5 -0
- data/test/rails311/app/views/beers/show.html.erb +5 -0
- data/test/rails311/app/views/chips/_form.html.erb +17 -0
- data/test/rails311/app/views/chips/edit.html.erb +6 -0
- data/test/rails311/app/views/chips/index.html.erb +21 -0
- data/test/rails311/app/views/chips/new.html.erb +5 -0
- data/test/rails311/app/views/chips/show.html.erb +5 -0
- data/test/rails311/app/views/layouts/application.html.erb +14 -0
- data/test/rails311/app/views/sports/_form.html.erb +17 -0
- data/test/rails311/app/views/sports/edit.html.erb +6 -0
- data/test/rails311/app/views/sports/index.html.erb +21 -0
- data/test/rails311/app/views/sports/new.html.erb +5 -0
- data/test/rails311/app/views/sports/show.html.erb +5 -0
- data/test/rails311/config.ru +4 -0
- data/test/rails311/config/application.rb +48 -0
- data/test/rails311/config/boot.rb +6 -0
- data/test/rails311/config/database.yml +25 -0
- data/test/rails311/config/environment.rb +5 -0
- data/test/rails311/config/environments/development.rb +30 -0
- data/test/rails311/config/environments/production.rb +60 -0
- data/test/rails311/config/environments/test.rb +39 -0
- data/test/rails311/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails311/config/initializers/inflections.rb +10 -0
- data/test/rails311/config/initializers/mime_types.rb +5 -0
- data/test/rails311/config/initializers/secret_token.rb +7 -0
- data/test/rails311/config/initializers/session_store.rb +8 -0
- data/test/rails311/config/initializers/wrap_parameters.rb +14 -0
- data/test/rails311/config/locales/en.yml +5 -0
- data/test/rails311/config/routes.rb +64 -0
- data/test/rails311/db/development.sqlite3 +0 -0
- data/test/rails311/db/migrate/20111227222038_create_beers.rb +8 -0
- data/test/rails311/db/migrate/20111227222056_create_chips.rb +8 -0
- data/test/rails311/db/migrate/20111227222113_create_sports.rb +8 -0
- data/test/rails311/db/schema.rb +31 -0
- data/test/rails311/db/seeds.rb +7 -0
- data/test/rails311/db/test.sqlite3 +0 -0
- data/test/rails311/doc/README_FOR_APP +2 -0
- data/test/rails311/log/development.log +28 -0
- data/test/rails311/log/test.log +0 -0
- data/test/rails311/public/404.html +26 -0
- data/test/rails311/public/422.html +26 -0
- data/test/rails311/public/500.html +26 -0
- data/test/rails311/public/favicon.ico +0 -0
- data/test/rails311/public/index.html +241 -0
- data/test/rails311/public/robots.txt +5 -0
- data/test/rails311/script/rails +6 -0
- data/test/rails311/spec/routespec/requests/beers/beers_spec.rb +74 -0
- data/test/rails311/spec/routespec/requests/chips/chips_spec.rb +74 -0
- data/test/rails311/spec/routespec/requests/sports/sports_spec.rb +74 -0
- data/test/rails311/spec/routespec/support/routes.txt +21 -0
- data/test/rails311/spec/routespec/support/routes.yml +322 -0
- data/test/rails311/spec/routespec/templates/default_spec.erb +24 -0
- data/test/rails311/test/fixtures/beers.yml +11 -0
- data/test/rails311/test/fixtures/chips.yml +11 -0
- data/test/rails311/test/fixtures/sports.yml +11 -0
- data/test/rails311/test/functional/beers_controller_test.rb +49 -0
- data/test/rails311/test/functional/chips_controller_test.rb +49 -0
- data/test/rails311/test/functional/sports_controller_test.rb +49 -0
- data/test/rails311/test/performance/browsing_test.rb +12 -0
- data/test/rails311/test/test_helper.rb +13 -0
- data/test/rails311/test/unit/beer_test.rb +7 -0
- data/test/rails311/test/unit/chip_test.rb +7 -0
- data/test/rails311/test/unit/helpers/beers_helper_test.rb +4 -0
- data/test/rails311/test/unit/helpers/chips_helper_test.rb +4 -0
- data/test/rails311/test/unit/helpers/sports_helper_test.rb +4 -0
- data/test/rails311/test/unit/sport_test.rb +7 -0
- data/test/rails311/vendor/cache/actionmailer-3.1.1.gem +0 -0
- data/test/rails311/vendor/cache/actionpack-3.1.1.gem +0 -0
- data/test/rails311/vendor/cache/activemodel-3.1.1.gem +0 -0
- data/test/rails311/vendor/cache/activerecord-3.1.1.gem +0 -0
- data/test/rails311/vendor/cache/activeresource-3.1.1.gem +0 -0
- data/test/rails311/vendor/cache/activesupport-3.1.1.gem +0 -0
- data/test/rails311/vendor/cache/arel-2.2.1.gem +0 -0
- data/test/rails311/vendor/cache/builder-3.0.0.gem +0 -0
- data/test/rails311/vendor/cache/erubis-2.7.0.gem +0 -0
- data/test/rails311/vendor/cache/hike-1.2.1.gem +0 -0
- data/test/rails311/vendor/cache/i18n-0.6.0.gem +0 -0
- data/test/rails311/vendor/cache/json-1.6.4.gem +0 -0
- data/test/rails311/vendor/cache/mail-2.3.0.gem +0 -0
- data/test/rails311/vendor/cache/mime-types-1.17.2.gem +0 -0
- data/test/rails311/vendor/cache/multi_json-1.0.4.gem +0 -0
- data/test/rails311/vendor/cache/polyglot-0.3.3.gem +0 -0
- data/test/rails311/vendor/cache/rack-1.3.5.gem +0 -0
- data/test/rails311/vendor/cache/rack-cache-1.1.gem +0 -0
- data/test/rails311/vendor/cache/rack-mount-0.8.3.gem +0 -0
- data/test/rails311/vendor/cache/rack-ssl-1.3.2.gem +0 -0
- data/test/rails311/vendor/cache/rack-test-0.6.1.gem +0 -0
- data/test/rails311/vendor/cache/rails-3.1.1.gem +0 -0
- data/test/rails311/vendor/cache/railties-3.1.1.gem +0 -0
- data/test/rails311/vendor/cache/rake-0.9.2.2.gem +0 -0
- data/test/rails311/vendor/cache/rdoc-3.12.gem +0 -0
- data/test/rails311/vendor/cache/sprockets-2.0.3.gem +0 -0
- data/test/rails311/vendor/cache/sqlite3-1.3.5.gem +0 -0
- data/test/rails311/vendor/cache/thor-0.14.6.gem +0 -0
- data/test/rails311/vendor/cache/tilt-1.3.3.gem +0 -0
- data/test/rails311/vendor/cache/treetop-1.4.10.gem +0 -0
- data/test/rails311/vendor/cache/tzinfo-0.3.31.gem +0 -0
- data/test/sandbox/awsome.txt +1 -0
- data/test/sandbox/cerveja/muito_legal/cool/cool_spec.rb +1 -0
- data/test/sandbox/cerveja/rad/rad_spec.rb +1 -0
- data/test/sandbox/cool.txt +4 -0
- data/test/sandbox/rails_root/routespec/templates/default_spec.erb +24 -0
- data/test/sandbox/requests/dynamic/dynamic_spec.rb +17 -0
- data/test/sandbox/requests/errors/errors_spec.rb +36 -0
- data/test/sandbox/requests/info_panel/info_panel_spec.rb +16 -0
- data/test/sandbox/requests/legacy/legacy_spec.rb +26 -0
- data/test/sandbox/requests2/dynamic/dynamic_spec.rb +17 -0
- data/test/sandbox/requests2/errors/errors_spec.rb +36 -0
- data/test/sandbox/requests2/info_panel/info_panel_spec.rb +16 -0
- data/test/sandbox/requests2/legacy/legacy_spec.rb +26 -0
- data/test/sandbox/routes.txt +21 -0
- data/test/sandbox/routes.yml +193 -0
- data/test/sandbox/seu_jorge.yml +3 -0
- data/test/test_builder.rb +118 -0
- data/test/test_config.rb +5 -0
- data/test/test_dyr.rb +56 -0
- data/test/test_fyle.rb +59 -0
- data/test/test_parser.rb +84 -0
- data/test/test_rails311.rb +15 -0
- data/test/test_routespec.rb +8 -0
- data/test/test_tasks.rb +26 -0
- data/test/test_template_vars.rb +18 -0
- metadata +382 -0
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Rails311::Application.load_tasks
|
Binary file
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require jquery
|
8
|
+
//= require jquery_ujs
|
9
|
+
//= require_tree .
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*= require_self
|
6
|
+
*= require_tree .
|
7
|
+
*/
|
@@ -0,0 +1,56 @@
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
2
|
+
|
3
|
+
body, p, ol, ul, td {
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background-color: #eee;
|
11
|
+
padding: 10px;
|
12
|
+
font-size: 11px;
|
13
|
+
}
|
14
|
+
|
15
|
+
a { color: #000; }
|
16
|
+
a:visited { color: #666; }
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
18
|
+
|
19
|
+
div.field, div.actions {
|
20
|
+
margin-bottom: 10px;
|
21
|
+
}
|
22
|
+
|
23
|
+
#notice {
|
24
|
+
color: green;
|
25
|
+
}
|
26
|
+
|
27
|
+
.field_with_errors {
|
28
|
+
padding: 2px;
|
29
|
+
background-color: red;
|
30
|
+
display: table;
|
31
|
+
}
|
32
|
+
|
33
|
+
#error_explanation {
|
34
|
+
width: 450px;
|
35
|
+
border: 2px solid red;
|
36
|
+
padding: 7px;
|
37
|
+
padding-bottom: 0;
|
38
|
+
margin-bottom: 20px;
|
39
|
+
background-color: #f0f0f0;
|
40
|
+
}
|
41
|
+
|
42
|
+
#error_explanation h2 {
|
43
|
+
text-align: left;
|
44
|
+
font-weight: bold;
|
45
|
+
padding: 5px 5px 5px 15px;
|
46
|
+
font-size: 12px;
|
47
|
+
margin: -7px;
|
48
|
+
margin-bottom: 0px;
|
49
|
+
background-color: #c00;
|
50
|
+
color: #fff;
|
51
|
+
}
|
52
|
+
|
53
|
+
#error_explanation ul li {
|
54
|
+
font-size: 12px;
|
55
|
+
list-style: square;
|
56
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
class BeersController < ApplicationController
|
2
|
+
# GET /beers
|
3
|
+
# GET /beers.json
|
4
|
+
def index
|
5
|
+
@beers = Beer.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.json { render json: @beers }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /beers/1
|
14
|
+
# GET /beers/1.json
|
15
|
+
def show
|
16
|
+
@beer = Beer.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render json: @beer }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /beers/new
|
25
|
+
# GET /beers/new.json
|
26
|
+
def new
|
27
|
+
@beer = Beer.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.json { render json: @beer }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /beers/1/edit
|
36
|
+
def edit
|
37
|
+
@beer = Beer.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /beers
|
41
|
+
# POST /beers.json
|
42
|
+
def create
|
43
|
+
@beer = Beer.new(params[:beer])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @beer.save
|
47
|
+
format.html { redirect_to @beer, notice: 'Beer was successfully created.' }
|
48
|
+
format.json { render json: @beer, status: :created, location: @beer }
|
49
|
+
else
|
50
|
+
format.html { render action: "new" }
|
51
|
+
format.json { render json: @beer.errors, status: :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /beers/1
|
57
|
+
# PUT /beers/1.json
|
58
|
+
def update
|
59
|
+
@beer = Beer.find(params[:id])
|
60
|
+
|
61
|
+
respond_to do |format|
|
62
|
+
if @beer.update_attributes(params[:beer])
|
63
|
+
format.html { redirect_to @beer, notice: 'Beer was successfully updated.' }
|
64
|
+
format.json { head :ok }
|
65
|
+
else
|
66
|
+
format.html { render action: "edit" }
|
67
|
+
format.json { render json: @beer.errors, status: :unprocessable_entity }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# DELETE /beers/1
|
73
|
+
# DELETE /beers/1.json
|
74
|
+
def destroy
|
75
|
+
@beer = Beer.find(params[:id])
|
76
|
+
@beer.destroy
|
77
|
+
|
78
|
+
respond_to do |format|
|
79
|
+
format.html { redirect_to beers_url }
|
80
|
+
format.json { head :ok }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
class ChipsController < ApplicationController
|
2
|
+
# GET /chips
|
3
|
+
# GET /chips.json
|
4
|
+
def index
|
5
|
+
@chips = Chip.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.json { render json: @chips }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /chips/1
|
14
|
+
# GET /chips/1.json
|
15
|
+
def show
|
16
|
+
@chip = Chip.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render json: @chip }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /chips/new
|
25
|
+
# GET /chips/new.json
|
26
|
+
def new
|
27
|
+
@chip = Chip.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.json { render json: @chip }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /chips/1/edit
|
36
|
+
def edit
|
37
|
+
@chip = Chip.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /chips
|
41
|
+
# POST /chips.json
|
42
|
+
def create
|
43
|
+
@chip = Chip.new(params[:chip])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @chip.save
|
47
|
+
format.html { redirect_to @chip, notice: 'Chip was successfully created.' }
|
48
|
+
format.json { render json: @chip, status: :created, location: @chip }
|
49
|
+
else
|
50
|
+
format.html { render action: "new" }
|
51
|
+
format.json { render json: @chip.errors, status: :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /chips/1
|
57
|
+
# PUT /chips/1.json
|
58
|
+
def update
|
59
|
+
@chip = Chip.find(params[:id])
|
60
|
+
|
61
|
+
respond_to do |format|
|
62
|
+
if @chip.update_attributes(params[:chip])
|
63
|
+
format.html { redirect_to @chip, notice: 'Chip was successfully updated.' }
|
64
|
+
format.json { head :ok }
|
65
|
+
else
|
66
|
+
format.html { render action: "edit" }
|
67
|
+
format.json { render json: @chip.errors, status: :unprocessable_entity }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# DELETE /chips/1
|
73
|
+
# DELETE /chips/1.json
|
74
|
+
def destroy
|
75
|
+
@chip = Chip.find(params[:id])
|
76
|
+
@chip.destroy
|
77
|
+
|
78
|
+
respond_to do |format|
|
79
|
+
format.html { redirect_to chips_url }
|
80
|
+
format.json { head :ok }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
class SportsController < ApplicationController
|
2
|
+
# GET /sports
|
3
|
+
# GET /sports.json
|
4
|
+
def index
|
5
|
+
@sports = Sport.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.json { render json: @sports }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /sports/1
|
14
|
+
# GET /sports/1.json
|
15
|
+
def show
|
16
|
+
@sport = Sport.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render json: @sport }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /sports/new
|
25
|
+
# GET /sports/new.json
|
26
|
+
def new
|
27
|
+
@sport = Sport.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.json { render json: @sport }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /sports/1/edit
|
36
|
+
def edit
|
37
|
+
@sport = Sport.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /sports
|
41
|
+
# POST /sports.json
|
42
|
+
def create
|
43
|
+
@sport = Sport.new(params[:sport])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @sport.save
|
47
|
+
format.html { redirect_to @sport, notice: 'Sport was successfully created.' }
|
48
|
+
format.json { render json: @sport, status: :created, location: @sport }
|
49
|
+
else
|
50
|
+
format.html { render action: "new" }
|
51
|
+
format.json { render json: @sport.errors, status: :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /sports/1
|
57
|
+
# PUT /sports/1.json
|
58
|
+
def update
|
59
|
+
@sport = Sport.find(params[:id])
|
60
|
+
|
61
|
+
respond_to do |format|
|
62
|
+
if @sport.update_attributes(params[:sport])
|
63
|
+
format.html { redirect_to @sport, notice: 'Sport was successfully updated.' }
|
64
|
+
format.json { head :ok }
|
65
|
+
else
|
66
|
+
format.html { render action: "edit" }
|
67
|
+
format.json { render json: @sport.errors, status: :unprocessable_entity }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# DELETE /sports/1
|
73
|
+
# DELETE /sports/1.json
|
74
|
+
def destroy
|
75
|
+
@sport = Sport.find(params[:id])
|
76
|
+
@sport.destroy
|
77
|
+
|
78
|
+
respond_to do |format|
|
79
|
+
format.html { redirect_to sports_url }
|
80
|
+
format.json { head :ok }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= form_for(@beer) do |f| %>
|
2
|
+
<% if @beer.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@beer.errors.count, "error") %> prohibited this beer from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @beer.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="actions">
|
15
|
+
<%= f.submit %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<h1>Listing beers</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th></th>
|
6
|
+
<th></th>
|
7
|
+
<th></th>
|
8
|
+
</tr>
|
9
|
+
|
10
|
+
<% @beers.each do |beer| %>
|
11
|
+
<tr>
|
12
|
+
<td><%= link_to 'Show', beer %></td>
|
13
|
+
<td><%= link_to 'Edit', edit_beer_path(beer) %></td>
|
14
|
+
<td><%= link_to 'Destroy', beer, confirm: 'Are you sure?', method: :delete %></td>
|
15
|
+
</tr>
|
16
|
+
<% end %>
|
17
|
+
</table>
|
18
|
+
|
19
|
+
<br />
|
20
|
+
|
21
|
+
<%= link_to 'New Beer', new_beer_path %>
|