Skip to content
Newer
Older
100644 356 lines (238 sloc) 14.5 KB
1e14c49 @ianwhite * Gemify resources_controller and friends (thanks Josh Goebel)
authored Mar 16, 2012
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
72ba5ba @ianwhite Improve the process for overriding ResourceMethods
authored May 20, 2011
9 * Make overriding ResourceMethods more sane. Thanks to Tom Stuart for the nudge.
10
7bd0908 @ianwhite Use YARD, and add some words about the rails3 version
authored Sep 10, 2010
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.
ea0ee5d @aughr Updated readme and history for the Rails 3 upgrade.
aughr authored Sep 7, 2010
14
cb77bc2 @ianwhite added ResourceMethods#destroy_resource, which calls destroy on the re…
authored Jan 27, 2010
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
bd221de @ianwhite ResourceMethods#new_resource looks in params[singular_resource_class_…
authored Jan 8, 2010
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
1d49505 @ianwhite Words
authored Jan 8, 2010
24 * resource_service.new now calls #build if the service is an association, or #new otherwise (reported by Jason Lee)
25
ff15968 @ianwhite More words: add note for people who have specs that expect resource_s…
authored Jan 8, 2010
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
472440a @ianwhite resource methods now in mixin to make overriding them easier
authored Dec 20, 2009
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
dd5aba0 @ianwhite Words
authored Dec 20, 2009
33 * Allow new_resource to use the block initialisation syntax in rails 2.3 (reported by Chris Hapgood)
34
66479f8 @ianwhite Fix bug where id is the same name as the resource name
authored Oct 8, 2009
35 * Fix bug where id is the same name as the resource name [mocoso]
36
f35fa17 @ianwhite Words
authored Sep 29, 2009
37 * Bugs introduced with RequestPathIntrospection (#5 and #6 on lighthouse) solved thanks to Sergei Serdyuk
38
9c1c237 @ianwhite Update History to reflect recent changes
authored Sep 19, 2009
39 * RC no longer uses the route that invoked the controller to figure out wildcard enclosing resources.
40
3008e7f @ianwhite Words
authored Sep 19, 2009
41 - this change means that you will no longer get those pesky 'NoRecognizedRoute' errors when your controller
9c1c237 @ianwhite Update History to reflect recent changes
authored Sep 19, 2009
42 is invoked by another route, such as a :controller/:action/:id route.
43
e55f0c3 @ianwhite RC is now more relaxed regarding 'NoRecognisedRoute', if the route ca…
authored Sep 18, 2009
44 * Further relaxed RC's route pickiness. If a route is not recognised, construct segments from the params
45
d0ee7b1 @ianwhite Updated changelog
authored Feb 13, 2009
46 * Relaxed RC's pickiness about what route was used to invoke a controller.
47
35fda33 @ianwhite Updated changelog
authored Oct 11, 2008
48 * Removed deprecation warning from save_resource, and added cautionary notes to the comments instead
49
8a3691d @ianwhite Added include_actions extension for including actions/customising inc…
authored Oct 10, 2008
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
23f8b9e @ianwhite Attribution
authored Oct 10, 2008
54 * use add_enclosing_resource to add your own enclosing resources if you're skipping load_enclosing_resources [Tom Stuart, Joel Chippindale]
9a359ab @ianwhite Updated CHANGELOG, and contributors
authored Oct 10, 2008
55
4b31d14 @ianwhite Updated CHENGELOG
authored Sep 14, 2008
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
ceaf1b9 @ianwhite The reason for the reversion in c21f35c has been fixed. Thanks Jason …
authored Sep 14, 2008
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?
4b31d14 @ianwhite Updated CHENGELOG
authored Sep 13, 2008
72
633fe45 @ianwhite Added note about spec:generate task, which ensures rspec_scaffold con…
authored Sep 8, 2008
73 * rspec compat: Added new rake task to test that an RC controller passes the default rspec_scaffold
74 controller specs.
75
10eaea5 @ianwhite Fixed failing regression spec in edge
authored Apr 27, 2008
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
46db2a1 resources_controller: Added ability to pass options to named route in…
ian authored Jan 26, 2008
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
1dca758 resources_controller: * changed :erp to :resource_path, and added :re…
ian authored Nov 19, 2007
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
cfa3d5e resources_controller: added Ardes::ResourcesController.actions and
ian authored Nov 18, 2007
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
dd20dcd resources_controller: Added resource_saved? method to controller. Thi…
ian authored Nov 18, 2007
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
8447d4c resources_controller: added error_messages_for_resource to Helper
ian authored Nov 15, 2007
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
6f90688 resources_controller: added :erp patch, doc and specs [thanks Chris H…
ian authored Nov 14, 2007
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
c3af167 Removed deprecated options (in r492 - I forgot to say so)
ian authored Nov 6, 2007
131 * Removed deprecated options (in r492 - I forgot to say so)
132
fc13862 resources_controller: coverage back to 100%
ian authored Nov 6, 2007
133 * Coverage back to 100%
134
1b8be92 resources_controller: you can alias an enclosing resource with :as
ian authored Nov 6, 2007
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
983e0df resources_controller: you can now specify which actions are loaded fr…
ian authored Nov 6, 2007
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
44316d0 resources_controller: - :polymorphic => true is back:
ian authored Oct 24, 2007
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
e8fc191 resources_controller: added specs for when you want to find_by_(somet…
ian authored Oct 12, 2007
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
6bf2334 resources_controller: Updated actions to be more in line with recent …
ian authored Oct 10, 2007
186 * Updated actions to be more in line with recent rails scaffold [Jason Lee <jlsync@gmail.com>]
187
604a147 resources_controller now uses before_filter (instead of prepend_befor…
ian authored Oct 4, 2007
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
1c137a5 reosurces_controller: resources_controller_for can now be specified m…
ian authored Oct 2, 2007
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
1dada75 resources_controller: First stab at namespace support:
ian authored Sep 18, 2007
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
f8a3878 Minor doc improvements
ian authored Sep 6, 2007
219 * Minor doc improvements
220 Speced better js response on edit and new actions [Jason Lee <jlsync@gmail.com>]
221
0059502 resources_controller: The Routing patch has been removed from RC as i…
ian authored Sep 6, 2007
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
2200ba9 * Major internal changes, and some API change: see the rdoc for details.
ian authored Sep 5, 2007
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
1dc4d3f resources_controller:
ian authored Aug 23, 2007
232 * Fixed some problems with internals of RC when :load_enclosing => true
233
68ddf96 * resources_controller now supports singleton resources! and much bet…
ian authored Aug 18, 2007
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
48c58cd resources_controller:
ian authored Aug 18, 2007
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
18e3939 resources_controller:
ian authored Aug 17, 2007
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
f4f78c8 resources_controller
ian authored Aug 17, 2007
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
f3d7fc4 resources_controller:
ian authored Aug 17, 2007
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
bee172f resources_controller: Removed Ardes::ResourcesController::Spec::ViewH…
ian authored Aug 17, 2007
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
0c5fcae Named path support is much improved. All named routes for the current…
ian authored Jul 30, 2007
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
8cf4bad resources_controller: Added flash tests [frederikfix at eml dot cc]
ian authored Jul 23, 2007
315 * Added flash tests [frederikfix at eml dot cc]
316
1535036 resources_controller: Added rjs actions [frederikfix at eml dot cc]
ian authored Jul 23, 2007
317 * Added rjs actions [frederikfix at eml dot cc]
318
1f3e3f4 Added Ardes::ResourcesController::Spec::ViewHelper for easy view testing
ian authored Jul 10, 2007
319 * Added Ardes::ResourcesController::Spec::ViewHelper for easy view testing
320
100ae48 Added Helper#form_for_resource for easy form generation, see rdoc for…
ian authored Jul 10, 2007
321 * Added Helper#form_for_resource for easy form generation, see rdoc for details
322
b7750a5 * Enclosed named paths use the new edge rails conventions for named r…
ian authored Jul 10, 2007
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
0181a4a Now handles enclosing named paths. You can reference named routes tha…
ian authored Jun 7, 2007
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
4e33aa8 resources_controller: (find|new)_resource(s) methods are now defined …
ian authored Jun 7, 2007
336 * (find|new)_resource(s) methods are now defined by resources_controller_for only
337 if they do not already exist
338
84470fa resources_controller: Better regexp for resources_request [Chris Hapg…
ian authored May 30, 2007
339 * Better regexp for resources_request [Chris Hapgood]
340
f042826 resources_controller: Added more specs to get coverage to 100%
ian authored May 10, 2007
341 * Added more specs to get coverage to 100%
342
6dccf6a Upgraded specs for latest edge and rpsec 0.9, improved Rakefile and s…
ian authored May 10, 2007
343 * Upgraded to rpsec 0.9, improved Rakefile and specs so that spec:plugins will work
344
4d8e78d Removed ApplicationController from spec/app.rb to avoid conflicts wit…
ian authored Feb 28, 2007
345 * Removed ApplicationController from spec/app.rb to avoid conflicts with en-
346 closing rails application
347
20d4f25 Added method_missing proxy to ResourceService, to enable the resource…
ian authored Feb 22, 2007
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
063f481 git-svn-id: https://svn.ardes.com/rails_plugins/resources_controller@200
ian authored Feb 22, 2007
351 * Fixed small error in flash message of destroy action [Dan Kubb]
352
7a47cc1 Removing experimental cruft
ian authored Feb 22, 2007
353 * Removing experimental cruft
354
6bf2334 resources_controller: Updated actions to be more in line with recent …
ian authored Oct 10, 2007
355 * CHANGELOG started
Something went wrong with that request. Please try again.