Tuesday, February 28, 2012

[Rails] Using a string column instead of an id column to differentiate records

How do you decide whether to use a string column or an id column to differentiate between different types of records?

Suppose you have a relationships table that maps users to forums. The possible relationships can be: subscriber, moderator, owner.

When does it make sense to move those relationship types to their own table and reference them through a relationship_type_id column? What's the criteria? Or is it better to use a string column to differentiate them?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/t2scvYNus4UJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate