Forum: Ruby on Rails about user domain

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
daociyiyou (Guest)
on 2008-11-07 05:35
(Received via mailing list)
I have an application which has the common content sharing and
customized content for the registered users,the registered user use
his control panel to make his customized part for the app.When anyone
browse this registered user's site using the user's domain,the site
has app's common and customized contents displaying.For example:if a
registered user's name is daociyiyou,he will have his site url like:
daociyiyou.com.
My question is:different registered users have different domains,but
these different domains  use the same controller and actions to access
their common and customized contents.How do i manage this? use the
rails route to deploy? but how to deploy? In addition,do i have to do
somthing with the server setting?Thank you for your help.
daociyiyou (Guest)
on 2008-11-07 09:07
(Received via mailing list)
anyone can tell me the key points about this problem?
daociyiyou (Guest)
on 2008-11-10 02:59
(Received via mailing list)
anyone can tell me the key points about this problem?
DHH (Guest)
on 2008-11-10 12:54
(Received via mailing list)
> My question is:different registered users have different domains,but
> these different domains  use the same controller and actions to access
> their common and customized contents.How do i manage this? use the
> rails route to deploy? but how to deploy? In addition,do i have to do
> somthing with the server setting?Thank you for your help.

Use the domain to lookup the account model and base everything off
that. For example:

class ApplicationController < ActionController::Base
  before_filter :set_application

  private
    def set_application
      @application = Application.find_by_domain(request.domain)
    end
end

class ArticlesController < ApplicationController
  def index
    @articles = @application.articles
  end

  def show
    @article = @application.articles.find(params[:id])
  end
end
daociyiyou (Guest)
on 2008-11-11 03:55
(Received via mailing list)
Thank you ! This should be the application internal implement and make
me relax much more.But i have another question,how do i generate urls
for diffrent domains and make them to be mapped to the same controller
and action?
Use the route setting and do something with the server?I ever used the
route ,but not for this problem.Can i manage it like this?
This topic is locked and can not be replied to.