What I want is, building this somehow with Rails 3.1:
![UML](https://i.stack.imgur.com/P0UVZ.png)

If `A` has set an id for `b_id`, it shouldn't be possible to setting an id for `c_id`. And for sure vice versa too.

I wish I could do at the database level from a migration (check constraint?). Is this somehow possible?
Or is it more affordable to do this in the model with validations?

My environment: 

* Ruby 1.9.3
* Rails 3.1.3
* SQLite 3.7.3