Hi, One of the plugins that I always use for rails, is resources_controller. It brings alot to building a restful web application, make_resourceful bring the same goodness but I prefer resources_controller
more information http://github.com/ianwhite/resources_controller/tree/master In essence it adds "ActiveResource compliant controller for your your RESTful models", your controller will know HOW to find a resource from its enclosing resources etc I find this approach very powerful and keeps those controllers DRY as a bone. So I am looking to add something similar to our favorite MERB, My question is, if anyone out there is listening or remotely interested. HOW? I personally think that adding a "ROUTE BEHAVIOR" where one can attach a RESOURCE_SPECIFICATION to a resourceful route, would be one way to go. we can then add a controller mixin based on the fact we have specifications for that route, that would bring methods like "resource", "resources" and "enclosing_resources" into play. HOW? because the controller would have resource_specifications, which it can use to determine HOW a resource or resources should be found. examples (probably a bad one) myhome/images resources == current_user.images enclosing_resource == @myhome (which is found via calling current_user) "myhome" resource route would have a specification of being a singleton and a find_method => :current_user "images" resources route would have a normal specification so when we hit the images controller it has these 2 specifications at its disposal, this next bit would have to be ORM agnostic. so a call to resources would in essence do this; current_user.images what we get from this is automatic scoping, which is nice example ----------- resource :myhome, :with_specification :singleton => true, :find_method => :current_user do resources :images, :with_specification end ok then what about! comments/1/images well the comments resource route would again have a normal specification but this time, the images controller would have the comments and images resource specifications, it can then use these again to find its resource, resource enclosing resource etc so we have the same code in the controller DRY but this time resources == @comment.images enclosing_resource == @comment hopefully you see what I mean by all of this? if you have read this far thanks for getting this far; any comments on this are welcome, let me know your thoughts; cheers. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/merb?hl=en -~----------~----~----~----~------~----~------~--~---
