List Info

Thread: hosting multiple blogs with the same app




hosting multiple blogs with the same app
user name
2006-10-07 07:06:54
Hi Scott,

Thanks for the tip.

Question #1: Since typo trac is down, I am not able to get
the latest typo
version. gem install, will I guess only fetch the latest
stable code.So can
you tell me the SVN location of the typo trunk.

Question #2: As I told earlier...i am almost done with most
of the changes
that I wanted to do. And multiple blogs facility is almost
working, except
that...correct blog_id doesn't get saved when creating a new
article. If I
drop to mysql prompt and change the blog_id manually then
everything works
as a charm and here I mean everything. Each user gets his
own sets of
resources, articles, Avatars (my own little stupid hack),
themes.
There ain't any problems regarding permissions also.
and stuff like:

http://192.168.2.12
8:8002/gnufied

http://192.168.2.128:8
002/kurt

works flawlessly. But currently I have to cook a hack I
guess for changing
blog_ids after save. If you can just point me, where exactly
an article gets
assigned blog_id, when its getting saved to the database, it
would be very
helpful.


gnufied

-----Original Message-----
From: typo-list-bouncesrubyforge.org
[mailto:typo-list-bouncesrubyforge.org] On Behalf Of
Scott Laird
Sent: Friday, October 06, 2006 11:47 PM
To: typo-listrubyforge.org
Subject: Re: [typo] hosting multiple blogs with the same app

Try looking at the trunk--it has a number of multi-blog
changes.  This might
Just Work.


Scott

On 10/6/06, hemant krishna <inxs.hemantgmail.com> wrote:
>
> Before save.... I tried setting following method call.
doesn't work... 
> :(
>
> article.set_blog_id(this_blog.id)
>
> >From where does the content picks its blog_id?
>
> I am on Typo 4.0.0.
>
>
>
> -----Original Message-----
> From: hemant krishna [mailto:inxs.hemantgmail.com]
> Sent: Friday, October 06, 2006 11:23 AM
> To: 'typo-listrubyforge.org'
> Subject: RE: hosting multiple blogs with the same app
>
>
> ok..i get it.
>
> I think content.rb is the one that is resetting the
blog_ids just 
> before the actual save.
> And I guess following call is the culprit:
>
> class Content < ActiveRecord::Base
>  def initialize(*args)
>     super(*args)
>     set_default_blog
>   end
>
>   def set_default_blog
>     if self.blog_id == nil or self.blog_id == 0
>       self.blog = Blog.default
>     end
>   end
>
> end
>
> Now...how do set some other values...there.
>
> -----Original Message-----
> From: hemant krishna [mailto:inxs.hemantgmail.com]
> Sent: Friday, October 06, 2006 11:05 AM
> To: 'typo-listrubyforge.org'
> Subject: hosting multiple blogs with the same app
>
>
> Hi All,
>
> I am modifying typo so as, I can host multiple blogs on
the same typo.
> And its almost done, except that...i am stuck at one
place.
>
> When a user posts a new article, depending upon current
blog_id, I 
> would like to set the blog_id attribute of article
object.
>
> So..in the admin/content_controller.rb:
>
> We have:
>
> def new_or_edit
>     if request.post?
>       set_article_author
>       save_attachments
>       logger.info("**** and blog id in article is
#{article.blog_id}")
>       if article.save
>         set_article_categories
>         set_the_flash
>         redirect_to :action => 'show', :id =>
article.id
>       end
>     end
> end
>
> So, just before the actual save, the value printed by
logger.info is 
> "**** and blog id in article is 2".But after
article.save is 
> called...whatever may be the current blog_id, the value
that gets 
> stored in database is always 1. And I have no clue, why
is this.
>
> Another pointer. new_or_edit calls a method
"get_or_build_article", 
> before actually saving article:
>
> when 'new'
>                  art = this_blog.articles.build
>                  logger.info("**** and blog id is
#{this_blog.id}")
>                  art.allow_comments =
this_blog.default_allow_comments
>                  art.allow_pings    =
this_blog.default_allow_pings
>                  art.published      = true
>                  art
>
>
> so...the above code also prints blog_id as 2. But
again...the value 
> that goes in database is always 1.
>
> Any clues, why is this?
>
>
> gnufied
>
>
> _______________________________________________
> Typo-list mailing list
> Typo-listrubyforge.org
> http:
//rubyforge.org/mailman/listinfo/typo-list
>
_______________________________________________
Typo-list mailing list
Typo-listrubyforge.org
http:
//rubyforge.org/mailman/listinfo/typo-list

_______________________________________________
Typo-list mailing list
Typo-listrubyforge.org
http:
//rubyforge.org/mailman/listinfo/typo-list
hosting multiple blogs with the same app
user name
2006-10-07 17:33:28


On 10/7/06, hemant kumar < inxs.hemantgmail.com">inxs.hemantgmail.com> wrote:
Hi Scott,

Thanks for the tip.

Question #1: Since typo trac is down, I am not able to get the latest typo
version. gem install, will I guess only fetch the latest stable code.So can
you tell me the SVN location of the typo trunk.

Question #2: As I told earlier...i am almost done with most of the changes
that I wanted to do. And multiple blogs facility is almost working, except
that...correct blog_id doesn't get saved when creating a new article. If I
drop to mysql prompt and change the blog_id manually then everything works
as a charm and here I mean everything. Each user gets his own sets of
resources, articles, Avatars (my own little stupid hack), themes.
There ain't any problems regarding permissions also.
and stuff like:

http://192.168.2.128:8002/gnufied

http://192.168.2.128:8002/kurt

works flawlessly. But currently I have to cook a hack I guess for changing
blog_ids after save. If you can just point me, where exactly an article gets
assigned blog_id, when its getting saved to the database, it would be very
helpful.


gnufied


Ok Scott, the problem is solved.
Figured it out somehow.....
Thanks for great work.

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )