views:

38

answers:

2

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.

+3  A: 

Yes, it is possible. By default A doesn't have to have a B unless you add code to enforce it.

John Topley
+1  A: 

You can check that there is a B by adding validates_presence_of :b in class A

Ceilingfish
i think you mean "enforce" instead of "check"?
mikezter