diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-18 19:18:01 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-18 19:18:01 +0000 |
commit | 7288fd3e3f288fb10fad347cff949b4202c3ae30 (patch) | |
tree | 3a2b0ad0b694d7b964da7fa531b5e135542ce3f6 /activerecord | |
parent | 39c64fff8ab1bba9057201dd2580f55e196c302a (diff) | |
download | rails-7288fd3e3f288fb10fad347cff949b4202c3ae30.tar.gz rails-7288fd3e3f288fb10fad347cff949b4202c3ae30.tar.bz2 rails-7288fd3e3f288fb10fad347cff949b4202c3ae30.zip |
Docs: warn that associations names shouldn't be reserved words. Closes #4378.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6770 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 00cac2f0ac..ad7d0a668d 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Docs: warn that associations names shouldn't be reserved words. #4378 [murphy@cYcnus.de, Josh Susser] + * Sanitize Base#inspect. #8392 [Nik Wakelin] * Replace the transaction {|transaction|..} semantics with a new Exception ActiveRecord::Rollback. [Koz] diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index f7c8e1d22f..56fe19a1db 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -95,6 +95,12 @@ module ActiveRecord # * <tt>Project#categories.empty?, Project#categories.size, Project#categories, Project#categories<<(category1),</tt> # <tt>Project#categories.delete(category1)</tt> # + # === A word of warning + # + # Don't create associations that have the same name as instance methods of ActiveRecord::Base. Since the association + # adds a method with that name to its model, it will override the inherited method and break things. + # For instance, #attributes and #connection would be bad choices for association names. + # # == Example # # link:files/examples/associations.png |