[typo] Recent Multi-Blog update Breaks

Piers Cawley pdcawley at bofh.org.uk
Mon Mar 20 12:36:41 EST 2006

"Sean Mountcastle" <smountcastle at gmail.com> writes:

> Piers,
> I just wanted to say thank you for all of the work you've done on Typo
> -- including the initial multi-blog support.  For my personal blog,
> multi-blog support is of no use to me, but I believe that the
> refactoring taking place will make Typo faster in the long run (and I
> have ideas for other projects where multi-blog support would be
> useful).
> It seems like there's been a bit of a backlash on the mailing list
> about multiblog support now that its in trunk -- hopefully you'll not
> be discouraged, as I believe there are many members of this mailing
> list looking forward to multiblog support (looking back through the
> number of times its been asked about).
> I am curious if you have a roadmap for this feature?  Some questions I
> had were as follows:
> - How will Typo route to the different blogs?  Using subdomain as blog
>   key? Modifying routes.rb with special URLs?

Dunno yet, we'll see what the code tells us. User stories for how
people *want* to use multiblogs will help us design this. If you have
a need for multiblogs, please bung a ticket in the trac explaining how
you would like to set a new blog up. Just a couple of paragraphs and
maybe a sketch of how you expect the screens to look (html, pdf,
whatever) would be very useful. 

> - I like what you've done with the Settings/Configuration but
>   searching through the set of blogs for one with a particular blog_name
>   for example might not be optimal ... perhaps the blog_name can be
>   promoted to its own field in the blogs table?

Yes, probably. But it's not an issue until we're actually handling
multiple blogs, so it can wait. As soon as I write anything that needs
to search on the blog name, you can bet it will get pulled up into the
blogs table proper.

> - Will you be adding blog_id to several of the other tables (such as
>   blacklist_patterns, categories, contents, resources, sidebars, tags,
>   text_filters and users)?

Yes, there wouldn't be much point without that, although some of those
will be habtm (or hopefully, by time we come to implement them,
has_many ... through) relationships.

> - Are there pieces of this work that we (I) can help out with? 
>   Perhaps taking a model/controller and the associated tests to work
>   on?

I've already had a go at doing a spike on adding:


And it's a *huge* change, touching pretty much everything. Even when I
'cheat' by overriding perform_action_without_filters (an undocumented,
but very useful ActionController::Base method) to look like:

  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

there's still an awful lot of stuff to find and change (it turns out
that 'new' doesn't respect scoping, which is annoying, arguably
correct, and fixable if you're prepared to mess with overriding
undocumented bits of Rails (which hasn't stopped us before)).

So, feel free to take it on, but do be aware that there's rather a lot
to deal with -- part of the reason I stopped and applied the patch
when I did was that it was getting awfully big...

Piers Cawley <pdcawley at bofh.org.uk>

More information about the Typo-list mailing list