[typo] multiple blog problem
hemant kumar
gnufied at gmail.com
Wed Oct 11 08:56:28 EDT 2006
For implementing multiple blogs using typo, following piece of code from
content.rb is proving to be a chicken and egg situation.
Reason: Let's say i don't have any article in contents table and i log into
the system, then it won't fetch the correct blog_id and blog object because
it doesn't know the user_id and blog_id of current user, which is both
available.
Is there anyway, I can initialize blog and blog_id attributes of contents
table, so that it can be called from outside?
def initialize(*args)
super(*args)
set_default_blog
end
def set_default_blog
if self.blog_id == nil or self.blog_id == 0
logger.info("############## Calling from model content.rb and
user_id is #{self.user_id} and blog_id is #{self.blog_id}")
self.blog = Blog.set_default_with_user(self.user_id)
# self.blog = Blog.default was the old code
end
end
with regards
gnufied
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/typo-list/attachments/20061011/64e1ac2a/attachment.html
More information about the Typo-list
mailing list