aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/migrations/foreign_keys.txt
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-09-13 20:28:01 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-09-13 20:28:01 +0100
commita17027d13a48e1e64b14a28e7d58e341812f8cb4 (patch)
tree09699984d7a4f612689f19e3e0ccb663ae207d3f /railties/doc/guides/migrations/foreign_keys.txt
parent96055414d6197b9705e408c17236f79372a007e5 (diff)
downloadrails-a17027d13a48e1e64b14a28e7d58e341812f8cb4.tar.gz
rails-a17027d13a48e1e64b14a28e7d58e341812f8cb4.tar.bz2
rails-a17027d13a48e1e64b14a28e7d58e341812f8cb4.zip
Merge docrails
Diffstat (limited to 'railties/doc/guides/migrations/foreign_keys.txt')
-rw-r--r--railties/doc/guides/migrations/foreign_keys.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/railties/doc/guides/migrations/foreign_keys.txt b/railties/doc/guides/migrations/foreign_keys.txt
new file mode 100644
index 0000000000..c1cde64096
--- /dev/null
+++ b/railties/doc/guides/migrations/foreign_keys.txt
@@ -0,0 +1,7 @@
+[[foreign_key]]
+== Active Record and Referential Integrity ==
+The Active Record way is that intelligence belongs in your models, not in the database. As such features such as triggers or foreign key constraints, which push some of that intelligence back into the database are not heavily used.
+
+Validations such as `validates_uniqueness_of` are one way in which models can enforce data integrity. The `:dependent` option on associations allows models to automatically destroy child objects when the parent is destroyed. Like anything which operates at the application level these cannot guarantee referential integrity and so some people augment them with foreign key constraints.
+
+Although Active Record does not provide any tools for working directly with such features, the `execute` method can be used to execute arbitrary SQL. There are also a number of plugins such as http://agilewebdevelopment.com/plugins/search?search=redhillonrails[redhillonrails] which add foreign key support to Active Record (including support for dumping foreign keys in `schema.rb`). \ No newline at end of file