I am able to get my setup working within the Rails console, but not
Note: I originally had memberships_id, but this did not work correctly.
I am trying to loop through the memberships table, printing a mix of
information from this table and from the dividends table.
My console session below shows that I have the relationships setup
>> member = Membership.find(1)
Great, now for the portion of my view in rails that is causing the
If I remove the third line (membership.dividend.broker_name), it will
find anything in the memberships table, but crashes if I try to display
anything from the dividend table.
The log file identifies the specific query that is causing a problem.
There is a record in the memberships table (probably quite a few) that
DO NOT have a corresponding record in the dividend table. I figured the
( || “Not Entered”) would suffice, but I’m still getting a nasty
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.broker_name
Do I have this setup correctly? Can active record handle the
relationship if corresponding rows don’t exist in the child table?
Thanks for reading and any possible suggestions toward resolution.