dynamic_controller 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. data/.gitignore +4 -4
  2. data/Gemfile +4 -4
  3. data/README.md +39 -2
  4. data/Rakefile +1 -1
  5. data/dynamic_controller.gemspec +26 -26
  6. data/lib/dynamic_controller/class_methods.rb +48 -0
  7. data/lib/dynamic_controller/helper_methods.rb +59 -0
  8. data/lib/dynamic_controller/instance_methods.rb +127 -0
  9. data/lib/dynamic_controller/resource.rb +21 -0
  10. data/lib/dynamic_controller/responder.rb +71 -0
  11. data/lib/dynamic_controller/version.rb +3 -3
  12. data/lib/dynamic_controller.rb +12 -180
  13. data/spec/controller_factory.rb +15 -0
  14. data/spec/controllers/crud_actions_json_spec.rb +3 -3
  15. data/spec/controllers/nested_crud_actions_html_spec.rb +9 -8
  16. data/spec/controllers/nested_crud_actions_json_spec.rb +11 -11
  17. data/spec/controllers/redefined_responders_html_spec.rb +112 -0
  18. data/spec/controllers/redefined_responders_json_spec.rb +95 -0
  19. data/spec/controllers/two_level_nested_crud_actions_html_spec.rb +134 -0
  20. data/spec/controllers/two_level_nested_crud_actions_json_spec.rb +98 -0
  21. data/spec/dummy/.gitignore +15 -15
  22. data/spec/dummy/Gemfile +12 -12
  23. data/spec/dummy/README.rdoc +261 -261
  24. data/spec/dummy/Rakefile +7 -7
  25. data/spec/dummy/app/assets/javascripts/application.js +15 -15
  26. data/spec/dummy/app/assets/stylesheets/application.css +13 -13
  27. data/spec/dummy/app/assets/stylesheets/scaffolds.css.scss +69 -69
  28. data/spec/dummy/app/controllers/application_controller.rb +3 -3
  29. data/spec/dummy/app/controllers/cities_controller.rb +95 -94
  30. data/spec/dummy/app/controllers/countries_controller.rb +86 -86
  31. data/spec/dummy/app/controllers/languages_controller.rb +95 -0
  32. data/spec/dummy/app/controllers/streets_controller.rb +97 -0
  33. data/spec/dummy/app/helpers/application_helper.rb +2 -2
  34. data/spec/dummy/app/models/city.rb +6 -5
  35. data/spec/dummy/app/models/country.rb +5 -5
  36. data/spec/dummy/app/models/language.rb +4 -0
  37. data/spec/dummy/app/models/street.rb +5 -0
  38. data/spec/dummy/app/views/cities/_form.html.erb +25 -25
  39. data/spec/dummy/app/views/cities/edit.html.erb +6 -6
  40. data/spec/dummy/app/views/cities/index.html.erb +29 -25
  41. data/spec/dummy/app/views/cities/new.html.erb +5 -5
  42. data/spec/dummy/app/views/cities/show.html.erb +15 -15
  43. data/spec/dummy/app/views/countries/_form.html.erb +21 -21
  44. data/spec/dummy/app/views/countries/edit.html.erb +6 -6
  45. data/spec/dummy/app/views/countries/index.html.erb +25 -23
  46. data/spec/dummy/app/views/countries/new.html.erb +5 -5
  47. data/spec/dummy/app/views/countries/show.html.erb +10 -10
  48. data/spec/dummy/app/views/languages/_form.html.erb +21 -0
  49. data/spec/dummy/app/views/languages/edit.html.erb +6 -0
  50. data/spec/dummy/app/views/languages/index.html.erb +23 -0
  51. data/spec/dummy/app/views/languages/new.html.erb +5 -0
  52. data/spec/dummy/app/views/languages/show.html.erb +10 -0
  53. data/spec/dummy/app/views/layouts/application.html.erb +14 -14
  54. data/spec/dummy/app/views/streets/_form.html.erb +25 -0
  55. data/spec/dummy/app/views/streets/edit.html.erb +6 -0
  56. data/spec/dummy/app/views/streets/index.html.erb +27 -0
  57. data/spec/dummy/app/views/streets/new.html.erb +5 -0
  58. data/spec/dummy/app/views/streets/show.html.erb +15 -0
  59. data/spec/dummy/config/application.rb +62 -62
  60. data/spec/dummy/config/boot.rb +6 -6
  61. data/spec/dummy/config/database.yml +25 -25
  62. data/spec/dummy/config/environment.rb +5 -5
  63. data/spec/dummy/config/environments/development.rb +37 -37
  64. data/spec/dummy/config/environments/production.rb +67 -67
  65. data/spec/dummy/config/environments/test.rb +37 -37
  66. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
  67. data/spec/dummy/config/initializers/inflections.rb +15 -15
  68. data/spec/dummy/config/initializers/mime_types.rb +5 -5
  69. data/spec/dummy/config/initializers/secret_token.rb +7 -7
  70. data/spec/dummy/config/initializers/session_store.rb +8 -8
  71. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
  72. data/spec/dummy/config/locales/en.yml +5 -5
  73. data/spec/dummy/config/routes.rb +8 -5
  74. data/spec/dummy/config.ru +4 -4
  75. data/spec/dummy/db/migrate/20120907174827_create_countries.rb +9 -9
  76. data/spec/dummy/db/migrate/20120907230842_create_cities.rb +11 -11
  77. data/spec/dummy/db/migrate/20120922010743_create_languages.rb +9 -0
  78. data/spec/dummy/db/migrate/20120929185302_create_streets.rb +11 -0
  79. data/spec/dummy/db/schema.rb +16 -1
  80. data/spec/dummy/db/seeds.rb +7 -7
  81. data/spec/dummy/doc/README_FOR_APP +2 -2
  82. data/spec/dummy/public/404.html +26 -26
  83. data/spec/dummy/public/422.html +26 -26
  84. data/spec/dummy/public/500.html +25 -25
  85. data/spec/dummy/public/index.html +241 -241
  86. data/spec/dummy/public/robots.txt +5 -5
  87. data/spec/dummy/script/rails +6 -6
  88. data/spec/factories.rb +9 -0
  89. data/spec/has_crud_actions_options_spec.rb +49 -0
  90. data/spec/spec_helper.rb +1 -0
  91. metadata +43 -16
@@ -1,9 +1,9 @@
1
- class CreateCountries < ActiveRecord::Migration
2
- def change
3
- create_table :countries do |t|
4
- t.string :name
5
-
6
- t.timestamps
7
- end
8
- end
9
- end
1
+ class CreateCountries < ActiveRecord::Migration
2
+ def change
3
+ create_table :countries do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -1,11 +1,11 @@
1
- class CreateCities < ActiveRecord::Migration
2
- def change
3
- create_table :cities do |t|
4
- t.string :name
5
- t.references :country
6
-
7
- t.timestamps
8
- end
9
- add_index :cities, :country_id
10
- end
11
- end
1
+ class CreateCities < ActiveRecord::Migration
2
+ def change
3
+ create_table :cities do |t|
4
+ t.string :name
5
+ t.references :country
6
+
7
+ t.timestamps
8
+ end
9
+ add_index :cities, :country_id
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ class CreateLanguages < ActiveRecord::Migration
2
+ def change
3
+ create_table :languages do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ class CreateStreets < ActiveRecord::Migration
2
+ def change
3
+ create_table :streets do |t|
4
+ t.string :name
5
+ t.references :city
6
+
7
+ t.timestamps
8
+ end
9
+ add_index :streets, :city_id
10
+ end
11
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20120907230842) do
14
+ ActiveRecord::Schema.define(:version => 20120929185302) do
15
15
 
16
16
  create_table "cities", :force => true do |t|
17
17
  t.string "name"
@@ -28,4 +28,19 @@ ActiveRecord::Schema.define(:version => 20120907230842) do
28
28
  t.datetime "updated_at", :null => false
29
29
  end
30
30
 
31
+ create_table "languages", :force => true do |t|
32
+ t.string "name"
33
+ t.datetime "created_at", :null => false
34
+ t.datetime "updated_at", :null => false
35
+ end
36
+
37
+ create_table "streets", :force => true do |t|
38
+ t.string "name"
39
+ t.integer "city_id"
40
+ t.datetime "created_at", :null => false
41
+ t.datetime "updated_at", :null => false
42
+ end
43
+
44
+ add_index "streets", ["city_id"], :name => "index_streets_on_city_id"
45
+
31
46
  end
@@ -1,7 +1,7 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
- # Mayor.create(name: 'Emanuel', city: cities.first)
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
@@ -1,2 +1,2 @@
1
- Use this README file to introduce your application and point to useful places in the API for learning more.
2
- Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
1
+ Use this README file to introduce your application and point to useful places in the API for learning more.
2
+ Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
@@ -1,26 +1,26 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/404.html -->
21
- <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
24
- </div>
25
- </body>
26
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -1,26 +1,26 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/422.html -->
21
- <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
24
- </div>
25
- </body>
26
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -1,25 +1,25 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/500.html -->
21
- <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
23
- </div>
24
- </body>
25
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>