Hi Michael, This is pretty cool, as it DRYs up the controller a bit. The problem is that you have to explicitly declare the finders. I was imagining something even more automated, where calling an automagic #foo method would go into params, find the appropriate id, and do a Foo.get. Furthemore, an #parent method would get the resource parent, if there is one, and a #resource method would get the resource instance that the controller is managing, if there is one. It would not be hard to implement all of this, but I need to look at Martin's resource_controller to see if this what he did :-)
..tony.. On Wed, Dec 17, 2008 at 1:41 PM, Michael Klishin < [email protected]> wrote: > > > On 18.12.2008, at 0:34, Tony Mann wrote: > > > On a related note, it would be great to have a #resource method in > > Controller that would grab :id from params and instantiate the > > class. No more foo = Foo.get(id) all over the controller code! > > > Here you go: http://gist.github.com/37243 > > 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 -~----------~----~----~----~------~----~------~--~---
