Fix mongoid 4 support by using #relation_metadata