From 7288fd3e3f288fb10fad347cff949b4202c3ae30 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 18 May 2007 19:18:01 +0000 Subject: 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 --- activerecord/lib/active_record/associations.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord/lib/active_record') 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 # * Project#categories.empty?, Project#categories.size, Project#categories, Project#categories<<(category1), # Project#categories.delete(category1) # + # === 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 -- cgit v1.2.3