Active Record Relationships

Do I have this setup correctly? Can active record handle the relationship if corresponding rows don't exist in the child table?

You have got the relationship set up correctly. However, member.dividend will only return the associated dividend object if one exists. If one does not exist, it will return nil. Therefore, you get the error because you're trying to call 'broker_name' on a nil object.

Basically, you need to add a bit more logic:

<% if membership.dividend %>   <%= member.dividend.broker_name %> <% else %>   Not Entered <% end %>

There is probably a way to make this a bit neater for your views, but hopefully this'll help you on your way.

Steve