aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/source/migrations/foreign_keys.txt
diff options
context:
space:
mode:
authorRyan Bigg <radarlistener@gmail.com>2008-10-22 21:46:49 +1030
committerRyan Bigg <radarlistener@gmail.com>2008-10-22 21:46:49 +1030
commit4a53eb8a79e3e0535ba19e6da38370a542ce4961 (patch)
tree965418cb69895e44879c7b1fa428e808b91aa66a /railties/doc/guides/source/migrations/foreign_keys.txt
parenta325010d6c9b2c69cab5da046e1106aad491b73f (diff)
parent303919c62660c68ca450a53ec5ef29ec2c615b7a (diff)
downloadrails-4a53eb8a79e3e0535ba19e6da38370a542ce4961.tar.gz
rails-4a53eb8a79e3e0535ba19e6da38370a542ce4961.tar.bz2
rails-4a53eb8a79e3e0535ba19e6da38370a542ce4961.zip
Merge branch 'master' of git@github.com:lifo/docrails
Diffstat (limited to 'railties/doc/guides/source/migrations/foreign_keys.txt')
-rw-r--r--railties/doc/guides/source/migrations/foreign_keys.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/railties/doc/guides/source/migrations/foreign_keys.txt b/railties/doc/guides/source/migrations/foreign_keys.txt
new file mode 100644
index 0000000000..8f796843b2
--- /dev/null
+++ b/railties/doc/guides/source/migrations/foreign_keys.txt
@@ -0,0 +1,8 @@
+[[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`).
+