inverse_of
02 Mar 2016one example when inverse_of
is useful.
spec:
let(:site) { create :site }
let!(:gl_account) { create :gl_account, site: site }
in this case gl_account
won’t be found for site
in ruby file:
site.gl_account # nil
you would have to reload site
to get access to gl_account
:
site.reload.gl_account # gl_account
using inverse_of
on site
association in Google::Account
would help:
belongs_to :site, inverse_of: :gl_account