Changing foreign keys' name and simplify the active record query