Wow Yehuda... You're famous :P Chris I strongly suggest you take a look into merb_parts. This looks like a perfect fit for it. A part is a controller in it's own right, with before and after filters, formated responses and template rendering. They're not routable which would perhaps be a bonus in this instnace. In your controller you could then pull apart the ajax request to work out which parts to invoke, and combine the results there. It seems like it's basically what you're doing, but on the public api instead ;)
Cheers Daniel On Fri, Nov 28, 2008 at 12:49 PM, CRS <[EMAIL PROTECTED]> wrote: > > Note that Merb::Dispatcher.handle is a private API and may change in the >> future. > > > Yes, I'd figured this. I can't imagine I'm doing this in the best possible > way. I'm very new to Merb. I'm just sort of hacking around currently, > getting a feel for how a request is fulfilled. > > >> >> What specifically are you trying to achieve out of curiosity? >> >> > I want to marshall many Ajax requests into one. > > Imagine a UI with 2 different datagrids, ProductGrid and OrderGrid. when a > page loads, these two grids each autoload themselves with their own Ajax > request. What I want to do, in fact *am* doing, is capturing both requests > on the client and combing the two into just one request. I send details > (including url, eg: "products/list", "orders/list") about each request as a > json-encoded array. > > so in Merb::Rack::Application#call, I decode the array of requests, and > loop over them like this: > > env["REQUEST_PATH"] = req["url"] > rack_response = ::Merb::Dispatcher.handle(Merb::Request.new(env)) > > I'd love some feedback on this. > > My girlfriend is big into JQuery. she said it like this: > > (08:28:59 PM) *Chris:* you know who Yehuda Katz is? > (08:29:06 PM) *Caroline:* Yes I do. > (08:29:15 PM) *Caroline:* Merb and jQuery guy. > (08:29:26 PM) *Caroline:* Merb creator, and he loves jquery. > (08:29:33 PM) *Caroline:* co-creator > (08:29:47 PM) *Chris:* I'm talking to him on Merb forum about my hack > today. > (08:30:10 PM) *Caroline:* Tell him your girfriend loves his book 'jQuery > in action'. > (08:30:18 PM) *Chris:* haha, I will! > (08:30:30 PM) *Caroline:* Thanks. It *is* an excellent book. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
