[Nitro] confused about app.dispatcher.root

Arne Brasseur arne at arnebrasseur.net
Sat Aug 18 04:13:30 EDT 2007


Bill Kelly schreef:
> Hi again,
>
> I'm encountering an error trying to fetch the index page on
> my site.  Essentially I have:
>
> class StoreController < Nitro::Controller
>
>   def index
>     @time = Time.now
>     redirect 'catalog'
>   end
>
>   # ...
>
> end
>
> app = Application.new
> app.dispatcher.root = StoreController
>
>
> ...the error I'm getting is:
>
>
> DEBUG: Rendering '/status_500'
> ERROR: Error while handling StoreController#index(status_500)
> ERROR: wrong number of arguments (1 for 0)
>   
Can you show us your catalog method? Does it take arguments? What's the 
URL you're loading?
> Then I noticed the blog actually sets app.dispatcher.root to
> its Post *model* class, and the controller is defined at
> Post::Controller.
>   
That's an alternative way of structuring your app. It's perfectly fine 
to just use the controller itself.
> So am I doing the wrong thing by setting app.dispatcher.root
> directly to my controller?
>   
Certainly not.

(ab)

-- 
Arne Brasseur
http://www.arnebrasseur.net
arne at arnebrasseur.net



More information about the Nitro-general mailing list