From bfa8869f72122d2d0d7083e56f41cb64daa87b9d Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Tue, 26 Jul 2011 17:10:22 +0200 Subject: [PATCH] fix cached widgets --- lib/widget/base.rb | 2 +- lib/widget/table.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/widget/base.rb b/lib/widget/base.rb index 63575a1f0e..dd4c3750f0 100644 --- a/lib/widget/base.rb +++ b/lib/widget/base.rb @@ -13,7 +13,7 @@ class Widget::Base < Widget ## # Query whether this widget class should be cached. def self.dont_cache? - @dont_cache || self == Widget::Base || Widget::Base.dont_cache? + @dont_cache or self == Widget::Base && Widget::Base.dont_cache? end def initialize(query) diff --git a/lib/widget/table.rb b/lib/widget/table.rb index 5d075de5be..3e6a2057e7 100644 --- a/lib/widget/table.rb +++ b/lib/widget/table.rb @@ -101,7 +101,8 @@ class Widget::Table < Widget::Base if @subject.result.count <= 0 write(content_tag(:p, l(:label_no_data), :class => "nodata")) else - render_widget(resolve_table, @subject, @options.reverse_merge(:to => @output)) + str = render_widget(resolve_table, @subject, @options.reverse_merge(:to => @output)) + @cache_output.write(str.html_safe) if @cache_output end end end