aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederick Cheung <frederick.cheung@gmail.com>2008-09-09 02:23:28 +0100
committerFrederick Cheung <frederick.cheung@gmail.com>2008-09-09 02:24:13 +0100
commitcbfeaa2563fd404fa5a2890a893fcd5fa1acc937 (patch)
treed77204c14288a7f4c9b49b8985d5f2239bd7b678
parentfd8c38435e68cfcaeab90398e09e58b0fa15d127 (diff)
downloadrails-cbfeaa2563fd404fa5a2890a893fcd5fa1acc937.tar.gz
rails-cbfeaa2563fd404fa5a2890a893fcd5fa1acc937.tar.bz2
rails-cbfeaa2563fd404fa5a2890a893fcd5fa1acc937.zip
add foreign keys section
-rw-r--r--railties/doc/guides/migrations/foreign_keys.txt7
-rw-r--r--railties/doc/guides/migrations/scheming.txt3
2 files changed, 9 insertions, 1 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..7ac183d2da
--- /dev/null
+++ b/railties/doc/guides/migrations/foreign_keys.txt
@@ -0,0 +1,7 @@
+== 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. These cannot however 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 in `schema.rb`). \ No newline at end of file
diff --git a/railties/doc/guides/migrations/scheming.txt b/railties/doc/guides/migrations/scheming.txt
index 8290f7116e..f85a0df5f7 100644
--- a/railties/doc/guides/migrations/scheming.txt
+++ b/railties/doc/guides/migrations/scheming.txt
@@ -41,4 +41,5 @@ By definition this will be a perfect copy of the database's structure but this w
=== Schema dumps and source control ===
-Because they are the authoritative source for your database schema, it is strongly recommended that you check them into source control. \ No newline at end of file
+Because they are the authoritative source for your database schema, it is strongly recommended that you check them into source control.
+