Used gem 'dm-constraints' and refactored database schema to use explicit fk constrints