On Aug 2, 2007, at 2:53 PM, ry dahl wrote:

> merb_dispatcher.rb:28
> controller = klass.build(request.body, request.params, route,  
> response)
> Why not just use a typical constructor?

For testability. I just recently separated this out. We need to be  
able to initialize and get a controller instance before we call  
parse_request to parse the request. This is so you can get an  
instance of your controller in your specs and setup mocks and whatnot  
before you call parse_request.  build just wraps up the same  
functionality into one method so it works exactly the same in  
Dispacther.handle. This is just to increase testability.


>
> merb_dispatcher.rb:35
> raise Merb::HTTPMethodNotAllowed.new(method, allowed)
> Why not check for this after the action has been dispatched to the  
> controller?

Because there is no valid controller/action to call if this gets  
raised. It's enforcing the rules of routing which happens before  
dispatching to the controller. I'm not opposed to changing the  
exception raised but this check does belong where it is IMHO.


>
> controller_mixin.rb:149
> def query_parse(qs, d = '&;')
> Why not offload query parsing onto Mongrel as much as possible?

Because mongrel does not have a method that parses nested parameters.  
so mongrel's query_parse will fail to parse ?foo[bar][baz]=nik but  
merb's query_parse will correctly handle it. I agree it's a bit  
obsfuscated though ;) Could possible be merged and refactored with  
normailize_params. I'll put it on the todo list.


Cheers-
-- Ezra Zygmuntowicz 
-- Founder & Ruby Hacker
-- [EMAIL PROTECTED]
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)


_______________________________________________
Merb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/merb-devel

Reply via email to