rc_rails 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. data/.gitignore +7 -0
  2. data/CHANGELOG +355 -0
  3. data/Gemfile +5 -0
  4. data/Gemfile.lock.development +117 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.rdoc +71 -0
  7. data/Rakefile +33 -0
  8. data/Todo.txt +1 -0
  9. data/lib/rc_rails.rb +9 -0
  10. data/lib/resources_controller/actions.rb +147 -0
  11. data/lib/resources_controller/active_record/saved.rb +15 -0
  12. data/lib/resources_controller/helper.rb +123 -0
  13. data/lib/resources_controller/include_actions.rb +37 -0
  14. data/lib/resources_controller/named_route_helper.rb +154 -0
  15. data/lib/resources_controller/railtie.rb +14 -0
  16. data/lib/resources_controller/request_path_introspection.rb +83 -0
  17. data/lib/resources_controller/resource_methods.rb +32 -0
  18. data/lib/resources_controller/singleton_actions.rb +21 -0
  19. data/lib/resources_controller/specification.rb +119 -0
  20. data/lib/resources_controller/version.rb +3 -0
  21. data/lib/resources_controller.rb +849 -0
  22. data/resources_controller.gemspec +29 -0
  23. data/spec/app/database.yml +5 -0
  24. data/spec/app/views/accounts/show.html.erb +0 -0
  25. data/spec/app/views/addresses/edit.html.erb +0 -0
  26. data/spec/app/views/addresses/index.html.erb +0 -0
  27. data/spec/app/views/addresses/new.html.erb +0 -0
  28. data/spec/app/views/addresses/show.html.erb +0 -0
  29. data/spec/app/views/admin/forums/create.html.erb +0 -0
  30. data/spec/app/views/admin/forums/destroy.html.erb +0 -0
  31. data/spec/app/views/admin/forums/edit.html.erb +0 -0
  32. data/spec/app/views/admin/forums/index.html.erb +0 -0
  33. data/spec/app/views/admin/forums/new.html.erb +0 -0
  34. data/spec/app/views/admin/forums/show.html.erb +0 -0
  35. data/spec/app/views/admin/forums/update.html.erb +0 -0
  36. data/spec/app/views/comments/edit.html.erb +0 -0
  37. data/spec/app/views/comments/index.html.erb +0 -0
  38. data/spec/app/views/comments/new.html.erb +0 -0
  39. data/spec/app/views/comments/show.html.erb +0 -0
  40. data/spec/app/views/forum_posts/edit.html.erb +0 -0
  41. data/spec/app/views/forum_posts/index.html.erb +0 -0
  42. data/spec/app/views/forum_posts/new.html.erb +0 -0
  43. data/spec/app/views/forum_posts/show.html.erb +0 -0
  44. data/spec/app/views/forums/create.html.erb +0 -0
  45. data/spec/app/views/forums/destroy.html.erb +0 -0
  46. data/spec/app/views/forums/edit.html.erb +0 -0
  47. data/spec/app/views/forums/index.html.erb +0 -0
  48. data/spec/app/views/forums/new.html.erb +0 -0
  49. data/spec/app/views/forums/show.html.erb +0 -0
  50. data/spec/app/views/forums/update.html.erb +0 -0
  51. data/spec/app/views/infos/edit.html.erb +0 -0
  52. data/spec/app/views/infos/show.html.erb +0 -0
  53. data/spec/app/views/interests/index.html.erb +0 -0
  54. data/spec/app/views/interests/show.html.erb +0 -0
  55. data/spec/app/views/owners/edit.html.erb +0 -0
  56. data/spec/app/views/owners/new.html.erb +0 -0
  57. data/spec/app/views/owners/show.html.erb +0 -0
  58. data/spec/app/views/tags/index.html.erb +0 -0
  59. data/spec/app/views/tags/new.html.erb +0 -0
  60. data/spec/app/views/tags/show.html.erb +0 -0
  61. data/spec/app/views/users/edit.html.erb +0 -0
  62. data/spec/app/views/users/index.html.erb +0 -0
  63. data/spec/app/views/users/show.html.erb +0 -0
  64. data/spec/app.rb +315 -0
  65. data/spec/controllers/accounts_controller_spec.rb +77 -0
  66. data/spec/controllers/addresses_controller_spec.rb +346 -0
  67. data/spec/controllers/admin_forums_controller_spec.rb +638 -0
  68. data/spec/controllers/comments_controller_spec.rb +380 -0
  69. data/spec/controllers/comments_controller_with_models_spec.rb +202 -0
  70. data/spec/controllers/forum_posts_controller_spec.rb +426 -0
  71. data/spec/controllers/forums_controller_spec.rb +694 -0
  72. data/spec/controllers/infos_controller_spec.rb +71 -0
  73. data/spec/controllers/interests_controller_via_forum_spec.rb +80 -0
  74. data/spec/controllers/interests_controller_via_user_spec.rb +114 -0
  75. data/spec/controllers/owners_controller_spec.rb +277 -0
  76. data/spec/controllers/resource_saved_spec.rb +47 -0
  77. data/spec/controllers/resource_service_in_forums_controller_spec.rb +37 -0
  78. data/spec/controllers/resource_service_in_infos_controller_spec.rb +36 -0
  79. data/spec/controllers/resource_service_in_interests_controller_via_forum_spec.rb +51 -0
  80. data/spec/controllers/tags_controller_spec.rb +83 -0
  81. data/spec/controllers/tags_controller_via_account_info_spec.rb +131 -0
  82. data/spec/controllers/tags_controller_via_forum_post_comment_spec.rb +144 -0
  83. data/spec/controllers/tags_controller_via_forum_post_spec.rb +133 -0
  84. data/spec/controllers/tags_controller_via_forum_spec.rb +173 -0
  85. data/spec/controllers/tags_controller_via_user_address_spec.rb +130 -0
  86. data/spec/controllers/users_controller_spec.rb +248 -0
  87. data/spec/lib/action_view_helper_spec.rb +143 -0
  88. data/spec/lib/bug_0001_spec.rb +22 -0
  89. data/spec/lib/include_actions_spec.rb +35 -0
  90. data/spec/lib/load_enclosing_resources_spec.rb +245 -0
  91. data/spec/lib/request_path_introspection_spec.rb +130 -0
  92. data/spec/lib/resource_methods_spec.rb +204 -0
  93. data/spec/lib/resources_controller_spec.rb +57 -0
  94. data/spec/models/comment_saved_spec.rb +24 -0
  95. data/spec/rspec_generator_task.rb +105 -0
  96. data/spec/spec_helper.rb +17 -0
  97. data/spec/verify_rcov.rb +52 -0
  98. metadata +193 -0
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ doc/*
2
+ .bundle
3
+ .rvmrc
4
+ tmp/*
5
+ .yardoc
6
+ pkg/
7
+ Gemfile.lock
data/CHANGELOG ADDED
@@ -0,0 +1,355 @@
1
+ = 2.1.0
2
+
3
+ * Gemify resources_controller and friends (thanks Josh Goebel)
4
+ gem name is `rc_rails`, see also `response_for_rails`, and `response_for_rc_rails`
5
+ * Remove Ardes namespace (BC preserved)
6
+
7
+ = Prior to gem release
8
+
9
+ * Make overriding ResourceMethods more sane. Thanks to Tom Stuart for the nudge.
10
+
11
+ * upgraded to Rails 3 and RSpec 2. Thanks to Andrew Bloomgarden for making this happen.
12
+
13
+ No BC with rails 2 - use the 2-3-stable branch for that.
14
+
15
+ * added ResourceMethods#destroy_resource, which calls destroy on the resource_service, which in turn finds the best way to
16
+ destroy the resource to trigger any association callbacks. Changed actions to use the destroy_resource method. (reported by Jason Lee)
17
+
18
+ NOTE: this may break some of your controller specs, they may report an unexpected :destroy message sent to an association.
19
+ You just need to expect this to happen when you have an enclosing resource.
20
+
21
+ * ResourceMethods#new_resource looks in params[singular_resource_class_name] for attributes, which makes RC much
22
+ more compatible with form_for (reported by Jason Lee)
23
+
24
+ * resource_service.new now calls #build if the service is an association, or #new otherwise (reported by Jason Lee)
25
+
26
+ NOTE: this may break some of your specs if you are expecting, say, a POST action to call :new on an association.
27
+ You just need to change the mocks to expect :build (when there's an enclosing resource, and resource_service.new is called)
28
+
29
+ * resource methods (new_resource, find_resource, and find_resources) are now in a mixin so it's easier
30
+ to override them. Just include a new mixin after the resources_controller_for call, or add them to your
31
+ action module.
32
+
33
+ * Allow new_resource to use the block initialisation syntax in rails 2.3 (reported by Chris Hapgood)
34
+
35
+ * Fix bug where id is the same name as the resource name [mocoso]
36
+
37
+ * Bugs introduced with RequestPathIntrospection (#5 and #6 on lighthouse) solved thanks to Sergei Serdyuk
38
+
39
+ * RC no longer uses the route that invoked the controller to figure out wildcard enclosing resources.
40
+
41
+ - this change means that you will no longer get those pesky 'NoRecognizedRoute' errors when your controller
42
+ is invoked by another route, such as a :controller/:action/:id route.
43
+
44
+ * Further relaxed RC's route pickiness. If a route is not recognised, construct segments from the params
45
+
46
+ * Relaxed RC's pickiness about what route was used to invoke a controller.
47
+
48
+ * Removed deprecation warning from save_resource, and added cautionary notes to the comments instead
49
+
50
+ * If you use your own Action modules, you can now define a module method #include_actions to do the :only / :except
51
+ handling yourself. See Ardes::ResourcesController::IncludeActions. This change is completely BC, you don't need
52
+ to do anything to any of your existing action modules.
53
+
54
+ * use add_enclosing_resource to add your own enclosing resources if you're skipping load_enclosing_resources [Tom Stuart, Joel Chippindale]
55
+
56
+ * The reason for the reversion in c21f35c has been fixed. Thanks Jason Lee for the bug report.
57
+
58
+ The problem was that I had changed resource_saved?'s behaviour to *not* saving the model if it had
59
+ already been saved. In the future resource_saved? will be deprecated, but not yet.
60
+
61
+ BTW. All of these changes to resource_saved? behaviour is aimed at making RC drop in compatible with
62
+ rspec's generated controller specs (try rake spec:generate).
63
+
64
+ To do that I need the default update action to use :update_attributes. This meant that the old strategy
65
+ of keeping track of saves by using save_resource wont work. Instead, we keep track by looking at the
66
+ AR's state (see lib/ardes/active_record/saved.rb) which is a far better solution anyway.
67
+
68
+ * API change: save_resource deprecated
69
+
70
+ So save_resource is now deprecated, just use resource.save
71
+ ActiveRecords can now be asked if they are saved?
72
+
73
+ * rspec compat: Added new rake task to test that an RC controller passes the default rspec_scaffold
74
+ controller specs.
75
+
76
+ * Added BC for 2-0-stable branch re: find_filter, and regression specs
77
+
78
+ * find_filter no longer exists in edge - updated accordingly [Jason Lee http://github.com/jlsync]
79
+
80
+ * Added ability to pass options to named route in form_for_resource
81
+
82
+ form_for_resource :url_options => {:gday => 'mate'}
83
+
84
+ # => action="/products/1?gday=mate" (for update)
85
+ # => action="/products?gday=mate" (for create)
86
+
87
+ * changed :erp to :resource_path, and added :resource_method.
88
+
89
+ This means you can connect a named route up with a REST action and also change the method
90
+
91
+ map.activate_account '/activate/:code', :controller => 'activations', :action => 'create', :resource_path => '/activations', :resource_method => :post
92
+
93
+ :erp retained for BC
94
+
95
+ * save_resource and resource_saved? added. These simply save the resource and cache
96
+ the result of that save. This means you can use the result of the resource save in your
97
+ response_for blocks (if you're using response_for)
98
+
99
+ response_for :create do |format|
100
+ if resource_saved?
101
+ format.html {}
102
+ else
103
+ format.html {}
104
+ end
105
+ end
106
+
107
+ def create
108
+ self.resource = new_resource
109
+ save_resource
110
+ end
111
+
112
+ * added Ardes::ResourcesController.actions and
113
+ Ardes::ResourcesController.singleton_actions accessors so you can set the
114
+ default actions module across your app
115
+
116
+ * Added resource_saved? method to controller. This is useful for sharing the
117
+ result of a save outside action methods (for example in response_for blocks)
118
+
119
+ * added error_messages_for_resource to Helper
120
+
121
+ * fixed form_for_resource when resource is new and controller is for singleton
122
+ resource
123
+
124
+ * added :erp patch, doc and specs [thanks Chris Hapgood for the initial patch]
125
+
126
+ Use the :erp param when you are routing a non RESTful route to your rc controller
127
+ This allows rc to load the resources using the route.
128
+
129
+ e.g. map.home '', :controller => 'forums', :action => 'index', :erp => '/forums'
130
+
131
+ * Removed deprecated options (in r492 - I forgot to say so)
132
+
133
+ * Coverage back to 100%
134
+
135
+ * you can alias an enclosing resource with :as
136
+
137
+ This can be useful when you have a tree like domain:
138
+
139
+ map.resources :categories do |category|
140
+ category.resources :categories
141
+ end
142
+
143
+ class CategoriesController < ApplicationController
144
+ resources_controller_for :categories
145
+ map_resource :category, :as => :parent
146
+ end
147
+
148
+ * you can now specify which actions are loaded from the actions module
149
+
150
+ resources_controller_for :forums, :only => [:index, :show]
151
+ resources_controller_for :forums, :actions => MyActions, :except => :destroy
152
+
153
+ The method used to achieve this is Ardes::ResourcesController::include_actions
154
+ which can be used in any ActionController when resources_controller is in your
155
+ plugins directory
156
+
157
+ * - :polymorphic => true is back:
158
+ resources_controller_for :tags
159
+ nested_in :taggable, :polymorphic => true
160
+
161
+ This will load the enclosing resource (which can be a mapped resource) as
162
+ @taggable as well as its default name
163
+
164
+ The following syntax is equivalent to the above two lines:
165
+ resources_controller_for :tags, :in => '?taggable'
166
+
167
+ And you can specify a single wildcard '?' as well as expanding wildcards '*':
168
+ resources_controller_for :images, :in => '?', :load_enclosing => false
169
+ # this will work for routes like /users/1/images, /forums/2/images, /featured/images
170
+
171
+ - test coverage is up
172
+
173
+ - moved some of the 'friend' functionality out of Specification, as it smelt bad
174
+
175
+ * added specs for when you want to find_by_(something other than id) (users,
176
+ addresses, interests)
177
+
178
+ Fixed a bug where the resource mapping was using name instead of segment to
179
+ match when a map should be used (this meant mapping didn't work for non
180
+ singleton resources)
181
+
182
+ Thanks to Inviz <invi...@gmail.com> and Matt Mower <matt.mo...@gmail.com>
183
+ in http://groups.google.com/group/resources_controller/browse_thread/thread/b71b2ce196a09d15
184
+ for the bug reports
185
+
186
+ * Updated actions to be more in line with recent rails scaffold [Jason Lee <jlsync@gmail.com>]
187
+
188
+ * resources_controller now uses before_filter (instead of prepend_before_filter)
189
+ for load_enclosing_resources. So the resources will be loaded at the point
190
+ where resources_controller_for is specified. However, it only adds the
191
+ filter if it's not already there - so you can play around with the order if
192
+ you need to:
193
+
194
+ prepend_before_filter :load_enclosing_resources
195
+ resources_controller_for :foos
196
+
197
+ (common case for the above is where superclass defines filters that need
198
+ access to enclosing resources)
199
+
200
+ * resources_controller_for can now be specified more than once in a controller
201
+ heirachy. The latter definition will overwrite the previous one, and will
202
+ also 'reset' the nestings.
203
+
204
+ * First stab at namespace support:
205
+ map.namespace :admin do |admin|
206
+ admin.resources :forums
207
+ end
208
+
209
+ module Admin
210
+ module Forums < ApplicationController
211
+ resources_controller_for :forums
212
+ end
213
+ end
214
+
215
+ in an action:
216
+ resources_path # => '/admin/forums'
217
+ enclosing_resources # => []
218
+
219
+ * Minor doc improvements
220
+ Speced better js response on edit and new actions [Jason Lee <jlsync@gmail.com>]
221
+
222
+ * The Routing patch has been removed from RC as it has been accepted and applied to edge (#8930).
223
+ This is not a dependency of RC, but it is of the specs - so grab latest edge to run them.
224
+
225
+ * Major internal changes, and some API change: see the rdoc for details.
226
+ The headlines:
227
+ - load_enclosing is now true by default
228
+ - BC: the old options work for now, but you'll get deprecation messages
229
+ - refactored a lot of code into friend classes - in particular there is now
230
+ ResourcesController::Specification which specifies how to find a resource from the route
231
+
232
+ * Fixed some problems with internals of RC when :load_enclosing => true
233
+
234
+ * resources_controller now supports singleton resources! and much better :load_enclosing support
235
+ Booya! =>
236
+ class TagsController < ApplicationController
237
+ resources_controller_for :tags, :load_enclosing => true
238
+ end
239
+
240
+ this will service all these routes (loading the resources into assigns for the view)
241
+
242
+ /tags
243
+ /forums/2/tags
244
+ /images/1/tags
245
+ /home/tags <= singular resource
246
+ /users/1/image/tags <= nested singular resource
247
+
248
+ Also
249
+
250
+ class BlogController < ApplicationController
251
+ resources_controller_for :blog, :singleton => true, :load_enclosing => true
252
+ end
253
+
254
+ class PostController < ApplicationController
255
+ resources_controller_for :post, :load_enclosing => true
256
+ end
257
+
258
+ for /campaigns/1/blog
259
+ /users/2/blog
260
+ /campaigns/1/blog/posts
261
+ /users/2/blog/posts
262
+
263
+ etc...
264
+
265
+ TODO: rewrite docs - for now check out the spec suite.
266
+ TODO: refactor code - I did it BDD stylee, so there's lots of specs but also a lot of code that 'is the simplest thing that makes the specs pass'
267
+
268
+ * resources_request has changed format - it now returns an array like this
269
+ [ {:name => "forums", :name_prefix => "forum_", :key => :forum_id, :id => "1"}, {:name => "posts"}]
270
+ Singular resources are detected properly (see spec/specs/resources_controller_spec for some tests).
271
+ This paves the way for singular_resource support, and better 'many routes/one controller' support
272
+
273
+ Decided that Patching Routing was a bad idea, so route is re-recognized using the request path. This
274
+ only happens for controllers with :load_enclosing => true
275
+
276
+ * You can now call methods such as enclosing_resource_path, enclosing_resources_path, etc
277
+ in your controller and view and the correct url helper will be called. These url_helpers are defined
278
+ as they are needed, so it's pretty fast.
279
+
280
+ * Removing routing decoration for now
281
+
282
+ * Enclosing resources are now all loaded by one method :load_enclosing which is a prepend_before_filter.
283
+ This means that you can access the enclosing resources in all before_filters, even when a subclass adds
284
+ more nestings.
285
+
286
+ Example:
287
+
288
+ class PostsController < ApplicationController
289
+ resources_controller_for :posts
290
+ end
291
+
292
+ class UserPostsController < PostsController
293
+ nested_in :user
294
+
295
+ before_filter {|c| raise 'boom' if @user.name == 'Santa'}
296
+ end
297
+
298
+ * Removed ResourceService proxy class. This was mainly used for BC with rails <= 1.2.2. If you're
299
+ using this, then freeze to r377 of resources_controller. The resource_service is now either an
300
+ ActiveRecord or association proxy.
301
+
302
+ * Added route decoration to access the recognized route in the controller (for future parsing of
303
+ singular resources, and better polymorphic support)
304
+
305
+ * Removed Ardes::ResourcesController::Spec::ViewHelper as it's best to not have a dependency
306
+ like this in your specs. Just stub out the resource methods that are needed by that view,
307
+ or use the default assigns.
308
+
309
+ * Named path support is much improved. All named routes for the current resource can be
310
+ called by substituting 'resource'. E.g. the following methods in your controller or
311
+ view will work: :formatted_resource_path, :preview_resource_path (if :preview is in :member),
312
+ :resource_tags_path, etc, etc.
313
+ This helps with decoupling the model name from the controller and view.
314
+
315
+ * Added flash tests [frederikfix at eml dot cc]
316
+
317
+ * Added rjs actions [frederikfix at eml dot cc]
318
+
319
+ * Added Ardes::ResourcesController::Spec::ViewHelper for easy view testing
320
+
321
+ * Added Helper#form_for_resource for easy form generation, see rdoc for details
322
+
323
+ * Enclosed named paths use the new edge rails conventions for named routes.
324
+
325
+ So to get the path to edit a child tag resource (where resource is 'forum:1')
326
+ edit_resource_tag_path(@tag) # => '/forums/1/tags/2/edit'
327
+
328
+ * Handles options passed to named routes
329
+
330
+ resource_path(:sort_by => 'article') # => '/forums/2?sort_by=article'
331
+
332
+ * Now handles enclosing named paths. You can reference named routes that are
333
+ 'below' (or enclosed by) the current resource by appending resource_ to that
334
+ named route. [thanks Chris Hapgood for the initial idea]
335
+
336
+ * (find|new)_resource(s) methods are now defined by resources_controller_for only
337
+ if they do not already exist
338
+
339
+ * Better regexp for resources_request [Chris Hapgood]
340
+
341
+ * Added more specs to get coverage to 100%
342
+
343
+ * Upgraded to rpsec 0.9, improved Rakefile and specs so that spec:plugins will work
344
+
345
+ * Removed ApplicationController from spec/app.rb to avoid conflicts with en-
346
+ closing rails application
347
+
348
+ * Added method_missing proxy to ResourceService, to enable the resource_service
349
+ to be used for things other than find or new (for example Pagination) [Dan Kubb]
350
+
351
+ * Fixed small error in flash message of destroy action [Dan Kubb]
352
+
353
+ * Removing experimental cruft
354
+
355
+ * CHANGELOG started
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ gem 'pry'
@@ -0,0 +1,117 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rc_rails (2.1.0)
5
+ rails (>= 3.1.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.2)
11
+ actionpack (= 3.2.2)
12
+ mail (~> 2.4.0)
13
+ actionpack (3.2.2)
14
+ activemodel (= 3.2.2)
15
+ activesupport (= 3.2.2)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.1)
19
+ rack (~> 1.4.0)
20
+ rack-cache (~> 1.1)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.1.2)
23
+ activemodel (3.2.2)
24
+ activesupport (= 3.2.2)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.2)
27
+ activemodel (= 3.2.2)
28
+ activesupport (= 3.2.2)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activeresource (3.2.2)
32
+ activemodel (= 3.2.2)
33
+ activesupport (= 3.2.2)
34
+ activesupport (3.2.2)
35
+ i18n (~> 0.6)
36
+ multi_json (~> 1.0)
37
+ arel (3.0.2)
38
+ builder (3.0.0)
39
+ coderay (1.0.5)
40
+ diff-lcs (1.1.3)
41
+ erubis (2.7.0)
42
+ hike (1.2.1)
43
+ i18n (0.6.0)
44
+ journey (1.0.3)
45
+ json (1.6.5)
46
+ mail (2.4.4)
47
+ i18n (>= 0.4.0)
48
+ mime-types (~> 1.16)
49
+ treetop (~> 1.4.8)
50
+ method_source (0.7.1)
51
+ mime-types (1.17.2)
52
+ multi_json (1.1.0)
53
+ polyglot (0.3.3)
54
+ pry (0.9.8.4)
55
+ coderay (~> 1.0.5)
56
+ method_source (~> 0.7.1)
57
+ slop (>= 2.4.4, < 3)
58
+ rack (1.4.1)
59
+ rack-cache (1.2)
60
+ rack (>= 0.4)
61
+ rack-ssl (1.3.2)
62
+ rack
63
+ rack-test (0.6.1)
64
+ rack (>= 1.0)
65
+ rails (3.2.2)
66
+ actionmailer (= 3.2.2)
67
+ actionpack (= 3.2.2)
68
+ activerecord (= 3.2.2)
69
+ activeresource (= 3.2.2)
70
+ activesupport (= 3.2.2)
71
+ bundler (~> 1.0)
72
+ railties (= 3.2.2)
73
+ railties (3.2.2)
74
+ actionpack (= 3.2.2)
75
+ activesupport (= 3.2.2)
76
+ rack-ssl (~> 1.3.2)
77
+ rake (>= 0.8.7)
78
+ rdoc (~> 3.4)
79
+ thor (~> 0.14.6)
80
+ rake (0.9.2.2)
81
+ rdoc (3.12)
82
+ json (~> 1.4)
83
+ rspec (2.8.0)
84
+ rspec-core (~> 2.8.0)
85
+ rspec-expectations (~> 2.8.0)
86
+ rspec-mocks (~> 2.8.0)
87
+ rspec-core (2.8.0)
88
+ rspec-expectations (2.8.0)
89
+ diff-lcs (~> 1.1.2)
90
+ rspec-mocks (2.8.0)
91
+ rspec-rails (2.8.1)
92
+ actionpack (>= 3.0)
93
+ activesupport (>= 3.0)
94
+ railties (>= 3.0)
95
+ rspec (~> 2.8.0)
96
+ slop (2.4.4)
97
+ sprockets (2.1.2)
98
+ hike (~> 1.2)
99
+ rack (~> 1.0)
100
+ tilt (~> 1.1, != 1.3.0)
101
+ sqlite3 (1.3.5)
102
+ thor (0.14.6)
103
+ tilt (1.3.3)
104
+ treetop (1.4.10)
105
+ polyglot
106
+ polyglot (>= 0.3.1)
107
+ tzinfo (0.3.32)
108
+
109
+ PLATFORMS
110
+ ruby
111
+
112
+ DEPENDENCIES
113
+ pry
114
+ rc_rails!
115
+ rspec (>= 2.8.0)
116
+ rspec-rails (>= 2.8.0)
117
+ sqlite3
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2007-2012 Ian White - ian.w.white@gmail.com
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,71 @@
1
+ = resources_controller
2
+
3
+ is a plugin to facilitate inheritance and DRYness in your resources controllers. It introduces some abstraction to help
4
+ you override the default RESTful funtionality in a clean and simple manner.
5
+
6
+ The gem name is *rc_rails*
7
+
8
+ == Rails 3 version
9
+
10
+ Add this to your Gemfile
11
+
12
+ gem 'rc_rails'
13
+
14
+ == Resources
15
+
16
+ <b>Github</b> for code: http://github.com/ianwhite/resources_controller
17
+
18
+ <b>Rdoc.info</b> docs: http://rdoc.info/github/ianwhite/resources_controller/master/frames
19
+
20
+ <b>Google group</b> for questions: http://groups.google.com/group/resources_controller
21
+
22
+ <b>RailsConfEurope</b> presentation files: http://en.oreilly.com/railseurope2008/public/schedule/detail/3536
23
+
24
+ == for rails 2.x
25
+
26
+ use the rails2 branch: http://github.com/ianwhite/resources_controller/tree/rails2
27
+
28
+ == Run the specs
29
+
30
+ To get set up for development, do the following:
31
+
32
+ git clone git://github.com/ianwhite/resources_controller
33
+ cd resources_controller
34
+ cp Gemfile.lock.development Gemfile.lock
35
+ bundle
36
+ rake spec:generate
37
+ rake spec
38
+
39
+ == How to contribute
40
+
41
+ If you have found a bug, or have a new feature, then spec'd code is great.
42
+
43
+ To get set up and run the tests
44
+
45
+ git clone git://github.com/ianwhite/resources_controller
46
+ cd resources_controller
47
+ bundle
48
+ rake spec:all
49
+
50
+ == Contributors
51
+
52
+ The following people have made contributions to resources_controller. Please let me know if I've missed you out.
53
+
54
+ * Josh Goebel
55
+ * Andrew Bloomgarden
56
+ * Chris Hapgood
57
+ * Jason Lee
58
+ * Richard Hooker
59
+ * Matt Mower
60
+ * Inviz
61
+ * Dan Kubb
62
+ * Rein Henrichs
63
+ * Tom Stuart
64
+ * Joel Chippindale
65
+ * Tim Pope
66
+ * Tom ten Thij
67
+ * Sergei Serdyuk
68
+
69
+ == License
70
+
71
+ Copyright (c) 2007-2009 Ian White, MIT License
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'ResourcesController'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc', 'CHANGELOG', 'MIT-LICENSE')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ Bundler::GemHelper.install_tasks
24
+
25
+ require 'rspec/core/rake_task'
26
+ require File.expand_path('../spec/rspec_generator_task', __FILE__) # for spec:generate task
27
+
28
+ task :default => [:spec]
29
+
30
+ desc "Run the specs"
31
+ RSpec::Core::RakeTask.new(:spec => []) do |t|
32
+ t.pattern = "./spec/**/*_spec.rb"
33
+ end
data/Todo.txt ADDED
@@ -0,0 +1 @@
1
+ * features
data/lib/rc_rails.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'resources_controller'
2
+
3
+ # BC
4
+ module Ardes
5
+ ResourcesController = ::ResourcesController
6
+ module ActiveRecord
7
+ Saved = ::ResourcesController::ActiveRecord::Saved
8
+ end
9
+ end