Phoenix Rising wrote in post #962048: > Basically, Rails uses the has_many/one belongs_to features to "mimic" > the functionality of a database foreign key. A real foreign key, > however, is built DIRECTLY into the database structure itself instead > of relying on Rails to make it work.
Not quite. Your terminology is a little off. A foreign key is simply a value in one table which refers to a key field in another. Rails' associations use real foreign keys in this sense. What they do not do, however, is set up foreign key *constraints*. I think you're confusion the idea of a foreign key with that of a foreign key constraint. > This is useful in situations > where you have a Rails application, but other programs or programmers > connect directly to the same database to do work with it. This > happens a lot in corporate setups (data warehousing, etc.) Or anytime you try to use a DB administration tool to tweak a value! Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.