Subdomain Account Keys Best Practice

Hi all,

I’m thinking of useing sub-domains as account keys, something I’ve
played
with previously.

I have accounts and users, fairly standard, except that users can belong
to
many accounts, and accounts can have many users.

So I figure I need to have an area on the main domain, that allows users
to
view their account memberships and things. Sort of like a dashboard for
each user. When they login without a sub domain, all their membership
informaition, and cross-account information ( eg todo’s for all accounts
)
would be available. When they log in with a sub domain, all information
is
scoped to the account.

Is this thinking fraught with danger? or reasonably sane?

Thanx for any insights.

Daniel

On 1/16/07, Daniel N [email protected] wrote:

each user. When they login without a sub domain, all their membership

Daniel,

What you’re describing can be done without much trouble. I use a
similar model at trackplace.com. Just set aside some domains:

environment.rb

RESERVED_SUBDOMAINS = %w(
www www1 www2 www3 www4 www5 www6 www7 www8 www9 www10 web
app app1 app2 app3 app4 app5 app6 app7 app8 app9 app10
db db1 db2 db3 db4 db5 database
blog blogs weblog public private secure store stores help admin
admins
mail email emails root postmaster postmasters friend friends
test testing dev marketing search profile profiles group groups
forum forums
)

account.rb

validates_exclusion_of :subdomain, :in => RESERVED_SUBDOMAINS,
:message => ‘Web site name is reserved.’

Set aside a subdomain like ‘profile’ or ‘membership’ to handle
membership stuff and the request_routing plugin to handle routing by
subdomain.

Hope this helps,


Zack C.
http://depixelate.com
http://trackplace.com

On 1/17/07, Zack C. [email protected] wrote:

www www1 www2 www3 www4 www5 www6 www7 www8 www9 www10 web

:message => ‘Web site name is reserved.’

Set aside a subdomain like ‘profile’ or ‘membership’ to handle
membership stuff and the request_routing plugin to handle routing by
subdomain.

Hi Thanx for your input.

I’m not sure I understand what the request_routing plugin would be doing
here.

Also what benefit is using a special sub-domain over the base domain?

Cheers

On 1/17/07, Zack C. [email protected] wrote:

What you’re describing can be done without much trouble. I use a
test testing dev marketing search profile profiles group groups
subdomain.

The request_routing plugin allows you to route off of additional

members.example.com # => the area you want to provide to handle profiles

This is one way to do it…

Or a scheme like:

john.example.com/profile

probably makes more sense.

Ok I think I see what you mean. I’ll give it a try.

Thanx for you help

On 1/16/07, Daniel N [email protected] wrote:

environment.rb

account.rb

here.

Also what benefit is using a special sub-domain over the base domain?

Cheers

Daniel,

You said “… I need to have an area on the main domain, that allows
users to view their account memberships and things…”

The request_routing plugin allows you to route off of additional
conditions like the subdomain:

routes.rb

map.with_options(:controller => ‘users’, :conditions => { :subdomain
=> ‘members’ }) do |url|
url.profile ‘’
url.change_password ‘change_password’, :action =>
‘change_password’

end

members.example.com # => the area you want to provide to handle profiles

This is one way to do it…

Or a scheme like:

john.example.com/profile

probably makes more sense.


Zack

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs