I need to setup a relationship so that A has one B, but there will be some entries where A doesn't have a B. Is this possible? If not, how can this be done?
Thanks for reading.
I need to setup a relationship so that A has one B, but there will be some entries where A doesn't have a B. Is this possible? If not, how can this be done?
Thanks for reading.
Yes, it is possible. By default A doesn't have to have a B unless you add code to enforce it.
You can check that there is a B by adding validates_presence_of :b
in class A