Michael Neumann
4/5/2005 5:15:00 PM
Am Dienstag 05 April 2005 17:54 schrieb itsme213:
> "Michael Neumann" <mneumann@ntecs.de> wrote in message
>
> > * Ajax support (live updates). See examples/ajax/ajax.rb.
>
> That is great news. Is there some configuration needed? When I tried the
> ajax.rb I got the 1st page fine, but when I click on the "Helloooo" I got:
> undefined method `+' for
> nil:NilClassC:/ruby/lib/ruby/gems/1.8/gems/wee-0.8.0/examples/ajax/ajax.rb:
>2 3:in `update'
> C:/ruby/lib/ruby/gems/1.8/gems/wee-0.8.0/examples/ajax/ajax.rb:22:in
> `with_renderer_for'
> c:/ruby/lib/ruby/gems/1.8/gems/wee-0.8.0/lib/wee/core/presenter.rb:139:in
> `send_render_response'
Oops, sorry. @live_updates is not initialize... use this patch:
--- ajax.rb (revision 602)
+++ ajax.rb (working copy)
@@ -20,7 +20,7 @@
def update
send_render_response {
- r.text "Live-updates works! This is no. #{ @live_updates += 1}"
+ r.text "Live-updates works! This is no. #{ @live_updates =
(@live_updates || 0) + 1 }"
}
end
end
> > * FastCGI adaptor (working but not fully tested)
>
> Great news too!
>
> > For example, you can update a field with Ajax like this:
> >
> > def render
> > r.div.id('field')
> > r.anchor.onclick_update('field') { update_field }.with('Click here')
> > end
>
> Does this block-form of callback assume continuations? Is the other form:
> r.anchor.onclick_update('field', :update_field }.with('Click here')
> the non-callback version?
No, both do not involve continuations! The non-block form (:update_field) is
only for people that want to marshal the component state... blocks can't be
marshalled whereas symbols can.
Regards,
Michael