Lloyd Zusman wrote:
> Michael Neumann <mneumann / ntecs.de> writes:
> 
>>[ ... ]
>>
>>	* Added "Pageless" mode. In pageless mode, the URL displayed in your
>>	  browser always looks like "/app". The session id is stored as cookie
>>	  and there is no page_id, hence "pageless" mode. No backtracking is
>>	  performed! Example:
>>
>>	    require 'wee/pageless'
>>
>>	    app = Wee::Utils.app_for(YourMainComponent,
>>	      :session => Wee::PagelessSession,
>>	      :application => Wee::PagelessApplication)
>>
>>	    Wee::WEBrickAdaptor.
>>	      request_class(Wee::PagelessRequest).
>>	      register('/app' => app).
>>	      start
> 
> 
> Thank you for all your great work on wee.
> 
> I got the following error when trying to invoke an example in
> "Pageless" mode (wrapped to fit it better in this email message):
> 
>   /usr/local/lib/ruby/gems/1.9/gems/wee-0.7.0/lib/wee/utils/helper.rb:29:
>       in `app_for': uninitialized constant Wee::Md5IdGenerator (NameError)
>       from ./hello-wee.rb:22
> 
> Here's my code:
> 
>   #!/usr/bin/ruby
> 
>   require 'rubygems'
>   require 'wee'
>   require 'wee/pageless'
>   require 'wee/utils'
>   require 'wee/adaptors/webrick'
> 
>   class HelloWorld < Wee::Component
>     def click
>       @clicks = (@clicks || 0) + 1
>     end
> 
>     def render
>       r.h1.onclick_callback(:click).with("Hello World!")
>       r.text "#{ @clicks || 'No' } clicks"
>     end
>   end
> 
>   app = Wee::Utils.app_for(
>     HelloWorld.new.add_decoration(
>       Wee::PageDecoration.new("Hello World")),
>     :session => Wee::PagelessSession,
>     :application => Wee::PagelessApplication
>   )

First argument of app_for is the root-component class, not an object 
thereof. An object does not work, as each session needs it's own root 
component object. So you should use a block:

    app = Wee::Utils.app_for(
      nil,
      :session => Wee::PagelessSession,
      :application => Wee::PagelessApplication
    ) {
      HelloWorld.new.add_decoration(
        Wee::PageDecoration.new("Hello World"))
    }

That should work, despite that it look a little bit ugly ;-)

Regards,

   Michael