2008/10/1 [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > good work on the handbook by the way. > > my thinking behind defining at the route level would enable the > scoping to be automatically known, as the resource_route would hold > the specifications. > These can then be parsed on the controller just b4 dispatching to the > controller action, from the specifications we would automatically know > what scope we where in. > > so basically a route would have specifications sent through the > options when generating from the behaviors. > > images_controller.resource_specifications == [comment_spec, > images_spec] from the url "comment/1/images" > images_controller.resource_specifications == [myhome_spec, > images_spec] from the url "myhome/images" > > > then just as the controller has some nice remixes for the > authentication and conditional_get goodness we could also mixin > resourceful type goodness,
That is what I personally would go for, mixins. I use this pattern a lot in my resource controllers and I think we can incapsulate that into the same set of methods, #parent, #object, etc, that resource_controller has. http://gist.github.com/14042 To customize it, you just override what you need. To provide base class I'd use mixins, too, something like class Tickets < Merb::Controller include GenericActions::Show end If you want to create a singleton resource, like a profile, you can use something like is SingletonResource. where is method is just alias for include or some simple wrapper to allow options, similar to DataMapper. Keep in mind display method already does some help with simplifying of code of generic actions. It smartly uses template if it is available or falls back to to_whatever call on the object. About ORMs, we need to some up with some "Merb ORM API" that every ORM has adapter for, and we can use it in lots and lots of plugins. What do you think? -- MK --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
