add inverse_of docs to have_many
This commit is contained in:
parent
e6bc6d99e9
commit
d1e9a41fca
|
@ -486,6 +486,24 @@ module Shoulda
|
||||||
# should have_many(:games).autosave(true)
|
# should have_many(:games).autosave(true)
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
|
# ##### inverse_of
|
||||||
|
#
|
||||||
|
# Use `inverse_of` to assert that the `:inverse_of` option was specified.
|
||||||
|
#
|
||||||
|
# class Organization < ActiveRecord::Base
|
||||||
|
# has_many :employees, inverse_of: :company
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# # RSpec
|
||||||
|
# describe Organization
|
||||||
|
# it { should have_many(:employees).inverse_of(:company) }
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# # Minitest (Shoulda)
|
||||||
|
# class OrganizationTest < ActiveSupport::TestCase
|
||||||
|
# should have_many(:employees).inverse_of(:company)
|
||||||
|
# end
|
||||||
|
#
|
||||||
# @return [AssociationMatcher]
|
# @return [AssociationMatcher]
|
||||||
#
|
#
|
||||||
def have_many(name)
|
def have_many(name)
|
||||||
|
|
Loading…
Reference in New Issue