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.
- 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,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
|
data/spec/dummy/db/schema.rb
CHANGED
|
@@ -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 =>
|
|
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
|
data/spec/dummy/db/seeds.rb
CHANGED
|
@@ -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.
|
data/spec/dummy/public/404.html
CHANGED
|
@@ -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>
|
data/spec/dummy/public/422.html
CHANGED
|
@@ -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>
|
data/spec/dummy/public/500.html
CHANGED
|
@@ -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>
|