Use reject_if for nested attributes. It will reject attribute if already exist.
Test relation between User(author, learner) and course