add inverse_of docs to have_many

This commit is contained in:
Derek Bender 2016-05-24 10:02:15 -05:00 committed by Elliot Winkler
parent e6bc6d99e9
commit d1e9a41fca
1 changed files with 18 additions and 0 deletions

View File

@ -486,6 +486,24 @@ module Shoulda
# should have_many(:games).autosave(true)
# 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]
#
def have_many(name)