I have a configuration of a blog factory like this :
- blogcrea.com/a-blog/ -> blog = a-blog
- blogcrea.com/another-blog/ -> blog = another-blog
- blogcrea.com/blog-with-custom-domain/ -> blog = blog-with-custom-domain
But I also want to use fully domain names like this :
- www.myawsomeblog.com -> blog = blog-with-custom-domain
I host a lot of blogs and there is a lot of domain names also, so I cannot do a per case treatment.
I am thinking using before_dispatch (http://m.onkey.org/dispatcher-callbacks) to set up a dynamic blog name and use dynamically a path variable in the routes.rb. I was thinking of a global var but it seems a bad idea (Why aren't global (dollar-sign $) variables used?).
Do you think it's a good idea ? What is the best way to store the blog name during the request ?