[typo] Recent Multi-Blog update Breaks

Scott Laird scott at sigkill.org
Mon Mar 20 13:35:19 EST 2006


[Wow, that was ugly.  I've never really tried pasting code into gmail
before.  Let's see if this works]

Heh.  Easy.  Since we're single-threaded, we can just do:

  def perform_action_without_filters
    scope_for_content = {:find => {:conditions => "blog_id =
#{this_blog.id}"},
                         :create => {:blog_id => this_blog.id}}

    Content.with_scope(scope_for_content) do
      Article.with_scope(scope_for_content) do
        Comment.with_scope(scope_for_content) do
          Trackback.with_scope(scope_for_content) do
            Page.with_scope(scope_for_content) do
              $blog_id = this_blog.id
              super
            end
          end
        end
      end
    end

    class Content
      def initialize
        ...
        self.blog_id = $blog_id
      end
    end

Should work.  It's horrifically ugly, but it should end up working.

I'm not really advocating doing it this way, but it's probably the
shortest path to working multi-blog support.  It's also the shortest
path to madness, but we might be able to extract it into something
less evil.


Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/typo-list/attachments/20060320/0a9bb607/attachment-0001.htm 


More information about the Typo-list mailing list