List Info

Thread: Rethinking Content Whiteboards




Rethinking Content Whiteboards
user name
2006-09-28 10:22:29
At the moment we're holding whiteboards as a serialised
field in
contents table. Which was fine when we were also caching the
HTML
representations there too -- whiteboards generally got
(re)generated
during text formatting and got magically saved along with
the html
renderings.

But now, the rendered html is managed by the controller and
held in
a different sort of cache, so the article doesn't get saved,
so the
whiteboard data gets thrown away. Which is not good.

So, my thinking is add something like:

   class Whiteboard
     serialize :data
     
     def method_missing(:method, *args)
       method.to_s =~ /^(.*)(=?)$/
       key = $1
       is_assignment = !$2.blank?

       unless data.has_key? key
         return super(:method, *args)
       end

       if is_assignment
         data[key] = *args
       else
         data[key]
       end
     end
   end

And having a table definition like

   create_table :whiteboards do |t|
     t.column :name, :string
     t.column :data, :text
   end

The tricky part might be in getting a working acts_as_hash
implementation, but that's a SMOP.

Thoughts?
       
-- 
Piers Cawley <pdcawleybofh.org.uk>
http://www.bofh.org.uk/
_______________________________________________
Typo-list mailing list
Typo-listrubyforge.org
http:
//rubyforge.org/mailman/listinfo/typo-list
Rethinking Content Whiteboards
user name
2006-09-28 17:42:10
Sounds good.

After watching my logs yesterday, I'm seriously considering
ditching a
lot of the sweeper implementation and switching to something
like
this:

  if Article, Page, or Settings changed -> sweep
everything
  elsif Comment or Trackback -> sweep page, add +60
minute trigger to
sweep everything if one doesn't already exist.

We should probably also add a 'if comment is published' in
there
somewhere, because even spam comments are nuking my cache.


Scott

On 9/28/06, Piers Cawley <pdcawleybofh.org.uk> wrote:
> At the moment we're holding whiteboards as a serialised
field in
> contents table. Which was fine when we were also
caching the HTML
> representations there too -- whiteboards generally got
(re)generated
> during text formatting and got magically saved along
with the html
> renderings.
>
> But now, the rendered html is managed by the controller
and held in
> a different sort of cache, so the article doesn't get
saved, so the
> whiteboard data gets thrown away. Which is not good.
>
> So, my thinking is add something like:
>
>    class Whiteboard
>      serialize :data
>
>      def method_missing(:method, *args)
>        method.to_s =~ /^(.*)(=?)$/
>        key = $1
>        is_assignment = !$2.blank?
>
>        unless data.has_key? key
>          return super(:method, *args)
>        end
>
>        if is_assignment
>          data[key] = *args
>        else
>          data[key]
>        end
>      end
>    end
>
> And having a table definition like
>
>    create_table :whiteboards do |t|
>      t.column :name, :string
>      t.column :data, :text
>    end
>
> The tricky part might be in getting a working
acts_as_hash
> implementation, but that's a SMOP.
>
> Thoughts?
>
> --
> Piers Cawley <pdcawleybofh.org.uk>
> http://www.bofh.org.uk/
> _______________________________________________
> Typo-list mailing list
> Typo-listrubyforge.org
> http:
//rubyforge.org/mailman/listinfo/typo-list
>
_______________________________________________
Typo-list mailing list
Typo-listrubyforge.org
http:
//rubyforge.org/mailman/listinfo/typo-list
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )