I have models with many-to-many association for example User & Role which connected through RoleAssignment
table in DB1:
users
role_assignments
table in DB2:
roles
I can access user in DB1 with role_one.users
, but i cannot access roles in DB2 with user_one.roles
. It gives an exception
ActiveRecord::StatementInvalid: Mysql2::Error: Table 'db2_development.role_assignments' doesn't exist:
SELECT `roles`.* FROM `roles` INNER JOIN `role_assignments` ON `roles`.`id` = `role_assignments`.`role_id`
WHERE `role_assignments`.`user_id` = 1
Does anyone know how to access roles from user, or how to let rails know that role_assignments reside in DB1 not in DB2? thx