GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of lifo/doc-rails
Description: Repository for improving Rails documentation
Homepage: http://www.rubyonrails.org
Clone URL: git://github.com/zmalltalker/doc-rails.git
AssociationTypeMismatch docs: fixed example code indentation, and revised 
details
Xavier Noria (author)
Tue Apr 08 15:37:06 -0700 2008
commit  a4c36ec9c5d81c553a3d9e7e6db60201be2fe53e
tree    d5bbcbd28997eda1ef0430a8e2c74c8e33d63e34
parent  b13829ba19699ae8eb8c1ad46077c14f47aa78c7
...
11
12
13
14
 
15
16
17
18
19
20
21
22
23
24
25
26
 
 
 
 
 
 
 
27
28
29
 
 
30
31
32
...
11
12
13
 
14
15
 
 
 
 
 
 
 
 
 
 
 
16
17
18
19
20
21
22
23
 
 
24
25
26
27
28
0
@@ -11,22 +11,18 @@ module ActiveRecord #:nodoc:
0
   class SubclassNotFound < ActiveRecordError #:nodoc:
0
   end
0
 
0
- # Raised when object assigned to association is of incorrect type.
0
+ # Raised when an object assigned to an association has an incorrect type.
0
   #
0
- # Example:
0
- #
0
- # class Ticket < ActiveRecord::Base
0
- # has_many :patches
0
- # end
0
- #
0
- # class Patch < ActiveRecord::Base
0
- # belongs_to :ticket
0
- # end
0
- #
0
- # and somewhere in the code:
0
+ # class Ticket < ActiveRecord::Base
0
+ # has_many :patches
0
+ # end
0
+ #
0
+ # class Patch < ActiveRecord::Base
0
+ # belongs_to :ticket
0
+ # end
0
   #
0
- # @ticket.patches << Comment.new(:content => "Please attach tests to your patch.")
0
- # @ticket.save
0
+ # # Comments are not patches, this assigment raises AssociationTypeMismatch.
0
+ # @ticket.patches << Comment.new(:content => "Please attach tests to your patch.")
0
   class AssociationTypeMismatch < ActiveRecordError
0
   end
0
 

Comments

    No one has commented yet.