easy_admin_ui 0.5.9 → 0.5.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/VERSION +1 -1
  2. data/{vendor/plugins/make_resourceful/init.rb → config/initializers/make_resourceful.rb} +0 -0
  3. data/easy_admin_ui.gemspec +14 -60
  4. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/base.rb +0 -0
  5. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/builder.rb +0 -0
  6. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/default/accessors.rb +0 -0
  7. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/default/actions.rb +0 -0
  8. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/default/callbacks.rb +0 -0
  9. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/default/responses.rb +0 -0
  10. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/default/urls.rb +0 -0
  11. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/maker.rb +0 -0
  12. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/response.rb +0 -0
  13. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/serialize.rb +0 -0
  14. metadata +17 -63
  15. data/vendor/plugins/make_resourceful/.gitignore +0 -1
  16. data/vendor/plugins/make_resourceful/DEFAULTS +0 -148
  17. data/vendor/plugins/make_resourceful/LICENSE +0 -7
  18. data/vendor/plugins/make_resourceful/README.rdoc +0 -239
  19. data/vendor/plugins/make_resourceful/Rakefile +0 -31
  20. data/vendor/plugins/make_resourceful/VERSION +0 -1
  21. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/resourceful_scaffold_generator.rb +0 -87
  22. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/controller.rb +0 -5
  23. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/fixtures.yml +0 -10
  24. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/functional_test.rb +0 -50
  25. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/helper.rb +0 -2
  26. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/migration.rb +0 -13
  27. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/model.rb +0 -2
  28. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/unit_test.rb +0 -7
  29. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view__form.haml +0 -5
  30. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_edit.haml +0 -11
  31. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_index.haml +0 -5
  32. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_new.haml +0 -9
  33. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_partial.haml +0 -12
  34. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_show.haml +0 -14
  35. data/vendor/plugins/make_resourceful/spec/accessors_spec.rb +0 -474
  36. data/vendor/plugins/make_resourceful/spec/actions_spec.rb +0 -310
  37. data/vendor/plugins/make_resourceful/spec/base_spec.rb +0 -12
  38. data/vendor/plugins/make_resourceful/spec/builder_spec.rb +0 -332
  39. data/vendor/plugins/make_resourceful/spec/callbacks_spec.rb +0 -71
  40. data/vendor/plugins/make_resourceful/spec/integration_spec.rb +0 -394
  41. data/vendor/plugins/make_resourceful/spec/maker_spec.rb +0 -91
  42. data/vendor/plugins/make_resourceful/spec/response_spec.rb +0 -37
  43. data/vendor/plugins/make_resourceful/spec/responses_spec.rb +0 -314
  44. data/vendor/plugins/make_resourceful/spec/rspec-rails/LICENSE +0 -37
  45. data/vendor/plugins/make_resourceful/spec/rspec-rails/redirect_to.rb +0 -113
  46. data/vendor/plugins/make_resourceful/spec/rspec-rails/render_template.rb +0 -90
  47. data/vendor/plugins/make_resourceful/spec/serialize_spec.rb +0 -133
  48. data/vendor/plugins/make_resourceful/spec/spec_helper.rb +0 -319
  49. data/vendor/plugins/make_resourceful/spec/urls_spec.rb +0 -282
  50. data/vendor/plugins/make_resourceful/spec/views/things/create.rjs +0 -1
  51. data/vendor/plugins/make_resourceful/spec/views/things/destroy.rjs +0 -1
  52. data/vendor/plugins/make_resourceful/spec/views/things/edit.html.erb +0 -4
  53. data/vendor/plugins/make_resourceful/spec/views/things/edit.rjs +0 -1
  54. data/vendor/plugins/make_resourceful/spec/views/things/index.html.erb +0 -4
  55. data/vendor/plugins/make_resourceful/spec/views/things/index.rjs +0 -1
  56. data/vendor/plugins/make_resourceful/spec/views/things/new.html.erb +0 -4
  57. data/vendor/plugins/make_resourceful/spec/views/things/new.rjs +0 -1
  58. data/vendor/plugins/make_resourceful/spec/views/things/show.html.erb +0 -4
  59. data/vendor/plugins/make_resourceful/spec/views/things/show.rjs +0 -1
  60. data/vendor/plugins/make_resourceful/spec/views/things/update.rjs +0 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.9
1
+ 0.5.11
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "easy_admin_ui"
8
- s.version = "0.5.9"
8
+ s.version = "0.5.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Martin Moen Wulffeld"]
12
- s.date = "2012-02-09"
12
+ s.date = "2012-02-11"
13
13
  s.description = "Very simple DRY admin UI."
14
14
  s.email = "martin@wulffeld.org"
15
15
  s.extra_rdoc_files = [
@@ -32,69 +32,23 @@ Gem::Specification.new do |s|
32
32
  "app/views/easy_admin_ui/index.html.erb",
33
33
  "app/views/easy_admin_ui/new.html.erb",
34
34
  "app/views/easy_admin_ui/show.html.erb",
35
+ "config/initializers/make_resourceful.rb",
35
36
  "easy_admin_ui.gemspec",
36
37
  "lib/easy_admin_ui.rb",
37
38
  "lib/easy_admin_ui/core_ext.rb",
38
39
  "lib/easy_admin_ui/rails/engine.rb",
39
40
  "lib/easy_admin_ui/tasks.rb",
40
- "tasks/easy_admin_ui.rake",
41
- "vendor/plugins/make_resourceful/.gitignore",
42
- "vendor/plugins/make_resourceful/DEFAULTS",
43
- "vendor/plugins/make_resourceful/LICENSE",
44
- "vendor/plugins/make_resourceful/README.rdoc",
45
- "vendor/plugins/make_resourceful/Rakefile",
46
- "vendor/plugins/make_resourceful/VERSION",
47
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/resourceful_scaffold_generator.rb",
48
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/controller.rb",
49
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/fixtures.yml",
50
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/functional_test.rb",
51
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/helper.rb",
52
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/migration.rb",
53
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/model.rb",
54
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/unit_test.rb",
55
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view__form.haml",
56
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_edit.haml",
57
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_index.haml",
58
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_new.haml",
59
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_partial.haml",
60
- "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_show.haml",
61
- "vendor/plugins/make_resourceful/init.rb",
62
- "vendor/plugins/make_resourceful/lib/resourceful/base.rb",
63
- "vendor/plugins/make_resourceful/lib/resourceful/builder.rb",
64
- "vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb",
65
- "vendor/plugins/make_resourceful/lib/resourceful/default/actions.rb",
66
- "vendor/plugins/make_resourceful/lib/resourceful/default/callbacks.rb",
67
- "vendor/plugins/make_resourceful/lib/resourceful/default/responses.rb",
68
- "vendor/plugins/make_resourceful/lib/resourceful/default/urls.rb",
69
- "vendor/plugins/make_resourceful/lib/resourceful/maker.rb",
70
- "vendor/plugins/make_resourceful/lib/resourceful/response.rb",
71
- "vendor/plugins/make_resourceful/lib/resourceful/serialize.rb",
72
- "vendor/plugins/make_resourceful/spec/accessors_spec.rb",
73
- "vendor/plugins/make_resourceful/spec/actions_spec.rb",
74
- "vendor/plugins/make_resourceful/spec/base_spec.rb",
75
- "vendor/plugins/make_resourceful/spec/builder_spec.rb",
76
- "vendor/plugins/make_resourceful/spec/callbacks_spec.rb",
77
- "vendor/plugins/make_resourceful/spec/integration_spec.rb",
78
- "vendor/plugins/make_resourceful/spec/maker_spec.rb",
79
- "vendor/plugins/make_resourceful/spec/response_spec.rb",
80
- "vendor/plugins/make_resourceful/spec/responses_spec.rb",
81
- "vendor/plugins/make_resourceful/spec/rspec-rails/LICENSE",
82
- "vendor/plugins/make_resourceful/spec/rspec-rails/redirect_to.rb",
83
- "vendor/plugins/make_resourceful/spec/rspec-rails/render_template.rb",
84
- "vendor/plugins/make_resourceful/spec/serialize_spec.rb",
85
- "vendor/plugins/make_resourceful/spec/spec_helper.rb",
86
- "vendor/plugins/make_resourceful/spec/urls_spec.rb",
87
- "vendor/plugins/make_resourceful/spec/views/things/create.rjs",
88
- "vendor/plugins/make_resourceful/spec/views/things/destroy.rjs",
89
- "vendor/plugins/make_resourceful/spec/views/things/edit.html.erb",
90
- "vendor/plugins/make_resourceful/spec/views/things/edit.rjs",
91
- "vendor/plugins/make_resourceful/spec/views/things/index.html.erb",
92
- "vendor/plugins/make_resourceful/spec/views/things/index.rjs",
93
- "vendor/plugins/make_resourceful/spec/views/things/new.html.erb",
94
- "vendor/plugins/make_resourceful/spec/views/things/new.rjs",
95
- "vendor/plugins/make_resourceful/spec/views/things/show.html.erb",
96
- "vendor/plugins/make_resourceful/spec/views/things/show.rjs",
97
- "vendor/plugins/make_resourceful/spec/views/things/update.rjs"
41
+ "lib/resourceful/base.rb",
42
+ "lib/resourceful/builder.rb",
43
+ "lib/resourceful/default/accessors.rb",
44
+ "lib/resourceful/default/actions.rb",
45
+ "lib/resourceful/default/callbacks.rb",
46
+ "lib/resourceful/default/responses.rb",
47
+ "lib/resourceful/default/urls.rb",
48
+ "lib/resourceful/maker.rb",
49
+ "lib/resourceful/response.rb",
50
+ "lib/resourceful/serialize.rb",
51
+ "tasks/easy_admin_ui.rake"
98
52
  ]
99
53
  s.homepage = "http://github.com/wulffeld/easy_admin_ui"
100
54
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_admin_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-09 00:00:00.000000000 Z
12
+ date: 2012-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: kaminari
16
- requirement: &2168756380 !ruby/object:Gem::Requirement
16
+ requirement: &2156961860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.12.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2168756380
24
+ version_requirements: *2156961860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: formtastic
27
- requirement: &2168755900 !ruby/object:Gem::Requirement
27
+ requirement: &2156961380 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 1.2.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2168755900
35
+ version_requirements: *2156961380
36
36
  description: Very simple DRY admin UI.
37
37
  email: martin@wulffeld.org
38
38
  executables: []
@@ -56,69 +56,23 @@ files:
56
56
  - app/views/easy_admin_ui/index.html.erb
57
57
  - app/views/easy_admin_ui/new.html.erb
58
58
  - app/views/easy_admin_ui/show.html.erb
59
+ - config/initializers/make_resourceful.rb
59
60
  - easy_admin_ui.gemspec
60
61
  - lib/easy_admin_ui.rb
61
62
  - lib/easy_admin_ui/core_ext.rb
62
63
  - lib/easy_admin_ui/rails/engine.rb
63
64
  - lib/easy_admin_ui/tasks.rb
65
+ - lib/resourceful/base.rb
66
+ - lib/resourceful/builder.rb
67
+ - lib/resourceful/default/accessors.rb
68
+ - lib/resourceful/default/actions.rb
69
+ - lib/resourceful/default/callbacks.rb
70
+ - lib/resourceful/default/responses.rb
71
+ - lib/resourceful/default/urls.rb
72
+ - lib/resourceful/maker.rb
73
+ - lib/resourceful/response.rb
74
+ - lib/resourceful/serialize.rb
64
75
  - tasks/easy_admin_ui.rake
65
- - vendor/plugins/make_resourceful/.gitignore
66
- - vendor/plugins/make_resourceful/DEFAULTS
67
- - vendor/plugins/make_resourceful/LICENSE
68
- - vendor/plugins/make_resourceful/README.rdoc
69
- - vendor/plugins/make_resourceful/Rakefile
70
- - vendor/plugins/make_resourceful/VERSION
71
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/resourceful_scaffold_generator.rb
72
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/controller.rb
73
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/fixtures.yml
74
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/functional_test.rb
75
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/helper.rb
76
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/migration.rb
77
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/model.rb
78
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/unit_test.rb
79
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view__form.haml
80
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_edit.haml
81
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_index.haml
82
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_new.haml
83
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_partial.haml
84
- - vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_show.haml
85
- - vendor/plugins/make_resourceful/init.rb
86
- - vendor/plugins/make_resourceful/lib/resourceful/base.rb
87
- - vendor/plugins/make_resourceful/lib/resourceful/builder.rb
88
- - vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb
89
- - vendor/plugins/make_resourceful/lib/resourceful/default/actions.rb
90
- - vendor/plugins/make_resourceful/lib/resourceful/default/callbacks.rb
91
- - vendor/plugins/make_resourceful/lib/resourceful/default/responses.rb
92
- - vendor/plugins/make_resourceful/lib/resourceful/default/urls.rb
93
- - vendor/plugins/make_resourceful/lib/resourceful/maker.rb
94
- - vendor/plugins/make_resourceful/lib/resourceful/response.rb
95
- - vendor/plugins/make_resourceful/lib/resourceful/serialize.rb
96
- - vendor/plugins/make_resourceful/spec/accessors_spec.rb
97
- - vendor/plugins/make_resourceful/spec/actions_spec.rb
98
- - vendor/plugins/make_resourceful/spec/base_spec.rb
99
- - vendor/plugins/make_resourceful/spec/builder_spec.rb
100
- - vendor/plugins/make_resourceful/spec/callbacks_spec.rb
101
- - vendor/plugins/make_resourceful/spec/integration_spec.rb
102
- - vendor/plugins/make_resourceful/spec/maker_spec.rb
103
- - vendor/plugins/make_resourceful/spec/response_spec.rb
104
- - vendor/plugins/make_resourceful/spec/responses_spec.rb
105
- - vendor/plugins/make_resourceful/spec/rspec-rails/LICENSE
106
- - vendor/plugins/make_resourceful/spec/rspec-rails/redirect_to.rb
107
- - vendor/plugins/make_resourceful/spec/rspec-rails/render_template.rb
108
- - vendor/plugins/make_resourceful/spec/serialize_spec.rb
109
- - vendor/plugins/make_resourceful/spec/spec_helper.rb
110
- - vendor/plugins/make_resourceful/spec/urls_spec.rb
111
- - vendor/plugins/make_resourceful/spec/views/things/create.rjs
112
- - vendor/plugins/make_resourceful/spec/views/things/destroy.rjs
113
- - vendor/plugins/make_resourceful/spec/views/things/edit.html.erb
114
- - vendor/plugins/make_resourceful/spec/views/things/edit.rjs
115
- - vendor/plugins/make_resourceful/spec/views/things/index.html.erb
116
- - vendor/plugins/make_resourceful/spec/views/things/index.rjs
117
- - vendor/plugins/make_resourceful/spec/views/things/new.html.erb
118
- - vendor/plugins/make_resourceful/spec/views/things/new.rjs
119
- - vendor/plugins/make_resourceful/spec/views/things/show.html.erb
120
- - vendor/plugins/make_resourceful/spec/views/things/show.rjs
121
- - vendor/plugins/make_resourceful/spec/views/things/update.rjs
122
76
  homepage: http://github.com/wulffeld/easy_admin_ui
123
77
  licenses: []
124
78
  post_install_message:
@@ -1 +0,0 @@
1
- testapp
@@ -1,148 +0,0 @@
1
- There's a rough equivalence between a basic @make_resourceful@ call
2
- and a hand-made controller.
3
- This:
4
-
5
- class PostsController < ApplicationController
6
- make_resourceful { actions :all }
7
- end
8
-
9
- Creates a controller that works more or less like the one that follows.
10
- Note that the real code generated by make_resourceful
11
- is more extensible in various ways.
12
- Thus whenever possible, there are comments in the following controller
13
- indicating how to customize various bits of the controller.
14
-
15
- class PostsController < ApplicationController
16
- def index
17
- # Override #current_objects to change this
18
- @posts = Post.all
19
-
20
- # Use before :index to add something here
21
-
22
- # Use response_for :index to change this
23
- respond_to { |f| f.html; f.js }
24
- end
25
-
26
- def show
27
- # Override #current_object to change this
28
- @post = Post.find(params[:id])
29
-
30
- # Use before :show to add something here
31
-
32
- # Use response_for :show to change this
33
- respond_to { |f| f.html; f.js }
34
- end
35
-
36
- def create
37
- # Override #build_object to change this
38
- @post = Post.new(params[:post])
39
-
40
- # Use before :create to add something here
41
-
42
- if @post.save
43
- # Use after :create to add something here
44
-
45
- # Use response_for :create to change this
46
- respond_to do |f|
47
- f.html do
48
- flash[:notice] = "Create successful!"
49
- redirect_to post_path(@post)
50
- end
51
- f.js
52
- end
53
- else
54
- # Use after :create_fails to add something here
55
-
56
- # Use response_for :create_fails to change this
57
- respond_to do |f|
58
- format.html
59
- flash[:error] = "There was a problem!"
60
- render :action => :new, :status => 422
61
- end
62
- format.js
63
- end
64
- end
65
- end
66
-
67
- def update
68
- # Override #current_object to change this
69
- @post = Post.find(params[:id])
70
-
71
- # Use before :update to do something here
72
-
73
- if @post.update_attributes params[:post]
74
- # Use after :update to add something here
75
-
76
- # Use response_for :update to change this
77
- respond_to do |f|
78
- f.html do
79
- flash[:notice] = "Save successful!"
80
- redirect_to post_path(@post)
81
- end
82
- f.js
83
- end
84
- else
85
- # Use after :update_fails to add something here
86
-
87
- # Use response_for :update_fails to change this
88
- respond_to do |f|
89
- format.html
90
- flash[:error] = "There was a problem saving!"
91
- render :action => :edit, :status => 422
92
- end
93
- format.js
94
- end
95
- end
96
- end
97
-
98
- def new
99
- # Override #build_object to change this
100
- @post = Post.new(params[:post])
101
-
102
- # Use before :new to add something here
103
-
104
- # Use response_for :new to change this
105
- respond_to { |f| f.html; f.js }
106
- end
107
-
108
- def edit
109
- # Override #current_object to change this
110
- @post = Post.find(params[:id])
111
-
112
- # Use before :edit to add something here
113
-
114
- # Use response_for :edit to change this
115
- respond_to { |f| f.html; f.js }
116
- end
117
-
118
- def destroy
119
- # Override #current_object to change this
120
- @post = Post.find(params[:id])
121
-
122
- # Use before :destroy to do something here
123
-
124
- if @post.destroy
125
- # Use after :destroy to add something here
126
-
127
- # Use response_for :destroy to change this
128
- respond_to do |f|
129
- f.html do
130
- flash[:notice] = "Record deleted!"
131
- redirect_to posts_path(@post)
132
- end
133
- f.js
134
- end
135
- else
136
- # Use after :destroy_fails to add something here
137
-
138
- # Use response_for :destroy_fails to change this
139
- respond_to do |f|
140
- format.html
141
- flash[:error] = "There was a problem deleting!"
142
- render :back
143
- end
144
- format.js
145
- end
146
- end
147
- end
148
- end
@@ -1,7 +0,0 @@
1
- Copyright (c) 2007-2010 Hampton Catlin
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,239 +0,0 @@
1
- = make_resourceful
2
- ===== Take back control of your Controllers. Make them awesome. Make them sleek. Make them resourceful.
3
-
4
- REST is a fine pattern for designing controllers,
5
- but it can be pretty repetitive.
6
- Who wants to write out the same actions and copy the same model lookup logic
7
- all over their application?
8
-
9
- make_resourceful handles all that for you.
10
- It sets up all your RESTful actions and responses with next to no code.
11
- Everything has full, sensible default functionality.
12
-
13
- Of course, no controller _only_ uses the defaults.
14
- So make_resourceful can be massively customized,
15
- while still keeping your controllers trim and readable.
16
-
17
- == Get it!
18
-
19
- Rails
20
-
21
- $ ruby script/plugin install git://github.com/hcatlin/make_resourceful.git
22
-
23
- Git
24
-
25
- $ git clone git://github.com/hcatlin/make_resourceful.git
26
-
27
- == Use it!
28
-
29
- The easiest way to start with make_resourceful
30
- is to run the resource_scaffold generator.
31
- It uses the same syntax as the Rails scaffold_resource generator:
32
-
33
- $ script/generate resource_scaffold post title:string body:text
34
-
35
- It does, however, require {Haml}[http://haml-lang.com].
36
- You _are_ using Haml, right? No?
37
- I'll wait here while you go fall in love with it.
38
-
39
- If you want to try make_resourceful on one of your current controllers,
40
- just replace the mess of repetition with this:
41
-
42
- class FooController < ApplicationController
43
- make_resourceful do
44
- actions :all
45
- end
46
- end
47
-
48
- Those three lines will replace the entire default controller
49
- that comes out of the scaffold_resource generator.
50
-
51
- === Really?
52
-
53
- Yes.
54
-
55
- === Can I do nested resources?
56
-
57
- make_resourceful do
58
- actions :all
59
- belongs_to :post
60
- end
61
-
62
- === What if I want to use fancy permalinks?
63
-
64
- def current_object
65
- @current_object ||= current_model.find_by_permalink(params[:id])
66
- end
67
-
68
- === What about paging?
69
-
70
- def current_objects
71
- @current_objects ||= current_model.find(:all,
72
- :order => "created_at DESC", :page => {:current => params[:page], :size => 10 } )
73
- end
74
-
75
- === What if I want to do something in the middle of an action?
76
-
77
- before :show, :index do
78
- @page_title = "Awesome!"
79
- end
80
-
81
- after :create_fails do
82
- @page_title = "Not So Awesome!"
83
- end
84
-
85
- === What about all of my awesome respond_to blocks for my XML APIs and RJS responses?
86
-
87
- response_for :show do |format|
88
- format.html
89
- format.js
90
- format.xml
91
- end
92
-
93
- response_for :update_fails do |format|
94
- format.html { render :action => 'edit' }
95
- format.json { render :json => false.to_json, :status => 422 }
96
- end
97
-
98
- === So I guess I have to write responses for all my actions?
99
-
100
- Nope! make_resourceful makes them do the right thing by default.
101
- You only need to customize them if you want to do something special.
102
-
103
- === Seriously?!
104
-
105
- Yes!
106
-
107
- == Grok it!
108
-
109
- === +make_resourceful+ the Method
110
-
111
- The +make_resourceful+ block is where most of the action happens.
112
- Here you specify which actions you want to auto-generate,
113
- what code you want to run for given callbacks,
114
- and so forth.
115
-
116
- You also use the block to declare various bits of information about your controller.
117
- For instance, if the controller is nested, you'd call +belongs_to+.
118
- If you wanted to expose your models as some sort of text format,
119
- you'd call +publish+.
120
-
121
- Check out the documentation of Resourceful::Builder
122
- for more information on the methods you can call here.
123
-
124
- === Helper Methods
125
-
126
- make_resourceful provides lots of useful methods
127
- that can be used in your callbacks and in your views.
128
- They range from accessing the records you're looking up
129
- to easily generating URLs for a record
130
- to getting information about the action itself.
131
-
132
- Two of the most useful methods are +current_object+ and +current_objects+
133
- (note the subtle plurality difference).
134
- +current_objects+ only works for +index+,
135
- and returns all the records in the current model.
136
- +current_object+ works for all actions other than +index+,
137
- and returns the record that's currently being dealt with.
138
-
139
- The full documentation of the helper methods
140
- is in Resourceful::Default::Accessors and Resourceful::Default::URLs.
141
-
142
- === Nested Resources
143
-
144
- make_resourceful supports easy management of nested resources.
145
- This is set up with the Resourceful::Builder#belongs_to declaration.
146
- Pass in the name of the parent model,
147
-
148
- belongs_to :user
149
-
150
- and everything will be taken care of.
151
- When +index+ is run for GET /users/12/albums,
152
- parent_object
153
- will get <tt>User.find(params[:user_id])</tt>,
154
- and current_objects
155
- will get <tt>parent_object.albums</tt>.
156
- When +create+ is run for POST /users/12/albums,
157
- the newly created Album will automatically belong to the user
158
- with id 12.
159
-
160
- The normal non-scoped actions still work, too.
161
- GET /albums/15 runs just fine.
162
- make_resourceful knows that since there's no <tt>params[:user_id]</tt>,
163
- you just want to deal with the album.
164
-
165
- You can even have a single resource nested under several different resources.
166
- Just pass multiple parent names to the Resourceful::Builder#belongs_to, like
167
-
168
- belongs_to :user, :artist
169
-
170
- Then /users/15/albums and /artists/7/albums will both work.
171
-
172
- This does, however, mean that make_resourceful only supports one level of nesting.
173
- There's no automatic handling of /users/15/collections/437/albums.
174
- However, this is really the best way to organize most resources anyway;
175
- see this {article}[http://weblog.jamisbuck.org/2007/2/5/nesting-resources].
176
-
177
- If you really need a deeply nested controller,
178
- it should be easy enough to set up on your own.
179
- Just override current_model.
180
- See the next section for more details.
181
-
182
- === Overriding Methods
183
-
184
- Not only are helper methods useful to the developer to use,
185
- they're used internally by the actions created by make_resourceful.
186
- Thus one of the main ways make_resourceful can be customized
187
- is by overriding accessors.
188
-
189
- For instance, if you want to only look up the 10 most recent records for +index+,
190
- you're override +current_objects+.
191
- If you wanted to use a different model than that suggested by the name of the controller,
192
- you'd override +current_model+.
193
-
194
- When you're overriding methods that do SQL lookups, though, be a little cautious.
195
- By default, these methods cache their values in instance variables
196
- so that multiple SQL queries aren't run on multiple calls.
197
- When overriding them, it's wise for you to do the same.
198
- For instance,
199
-
200
- def current_object
201
- @current_object ||= current_model.find_by_name(params[:name])
202
- end
203
-
204
- === For More Information...
205
-
206
- Haven't found all the information you need in the RDoc?
207
- Still a little confused about something?
208
- Don't despair, there are still more resources available!
209
-
210
- * Read the source code!
211
- It's very straightforward,
212
- and make_resourceful is built to encourage overriding methods
213
- and hacking the source.
214
- * Nathan Weizenbaum has some good blog posts about make_resourceful.
215
- They may be a little outdated, but they should still be useful and explanatory.
216
- * On nesting and associations: {here}[http://nex-3.com/posts/55-nesting-and-make_resourceful].
217
- * An overview of make_resourceful 0.2.0 and 0.2.2: {here}[http://localhost:3000/posts/54-make_resourceful-0-2-0].
218
- * On Resourceful::Builder#publish
219
- and Resourceful::Serialize:
220
- {here}[http://nex-3.com/posts/35-make_resourceful-the-basics-of-publish] and
221
- {here}[http://nex-3.com/posts/36-make_resourceful-publish-extras].
222
- * There's an excellent, active Google Group http://groups.google.com/group/make_resourceful
223
- where people will be happy to answer your questions.
224
-
225
- ---
226
-
227
- Copyright 2007-2010 Hampton Catlin and Nathan Weizenbaum.
228
- Contributions by:
229
-
230
- * Russell Norris
231
- * Jonathan Linowes
232
- * Cristi Balan
233
- * Mike Ferrier
234
- * James Golick
235
- * Don Petersen
236
- * Alex Ross
237
- * Tom Stuart
238
- * Glenn Powell
239
- * Johannes Jörg Schmidt