I looked all over for an explanation on how to use the domain or subdomain as the account key (a la campfirenow.com) and now I have it…
All it takes is putting the following in the application controller.
class ApplicationController < ActionController::Base
attr_writer :account
attr_reader :account
before_filter {|c|
c.account = Account.find_by_subdomain(
c.request.subdomains.first
)
}
end
Then you can use it in any controller as follows:
class BlogController < ApplicationController
def index
render_text account.subdomain
end
end
Check it out here…
Recent Comments