"Scott Laird" <[EMAIL PROTECTED]> writes:
> [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.
If we're happy with monkeying with undocumented methods, then it's
better to just avoid the global and do:
class Content
def initialize(attributes = {})
attributes.reverse_merge!(scope(:create)) if scoped?(:create)
super(attributes)
end
end
> 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.
See above. I'll have a crack at doing a spike with this approach
tomorrow (well, later today, after I've been asleep for a bit).
--
Piers Cawley <[EMAIL PROTECTED]>
http://www.bofh.org.uk/
_______________________________________________
Typo-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/typo-list