Base-camp Style Subdomains and IDs of Models

Posted by Newy on Stack Overflow See other posts from Stack Overflow or by Newy
Published on 2010-05-12T01:14:38Z Indexed on 2010/05/12 1:24 UTC
Read the original article Hit count: 344

Filed under:

I have an app that has Basecamp-style subdomains, that is, I have Projects, Users, Apples and Oranges. The Users, Apples and Oranges are all keyed to a Project and only exist in the http://project.myapp.com. I added a project_id to Users, Apples and Oranges and everything works, except of course that the ids of those three objects increment globally, and throughout my app I lookup objects by that id.

This doesn't seem like best practice. Should I instead do lookups by a secondary key? How does that affect efficiency? If there's a good blog post that covers this, would be wesome.

© Stack Overflow or respective owner

Related posts about ruby-on-rails