Add note about polymorphic associations on have_many
[ci skip]
This commit is contained in:
parent
ca960e609b
commit
670f154afc
|
@ -276,6 +276,23 @@ module Shoulda
|
||||||
# should have_many(:friends)
|
# should have_many(:friends)
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
|
# Note that polymorphic associations are automatically detected and do not
|
||||||
|
# need any qualifiers:
|
||||||
|
#
|
||||||
|
# class Person < ActiveRecord::Base
|
||||||
|
# has_many :pictures, as: :imageable
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# # RSpec
|
||||||
|
# describe Person do
|
||||||
|
# it { should have_many(:pictures) }
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# # Test::Unit
|
||||||
|
# class PersonTest < ActiveSupport::TestCase
|
||||||
|
# should have_many(:pictures)
|
||||||
|
# end
|
||||||
|
#
|
||||||
# #### Qualifiers
|
# #### Qualifiers
|
||||||
#
|
#
|
||||||
# ##### conditions
|
# ##### conditions
|
||||||
|
|
Loading…
Reference in New Issue