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