 <p>You must create a new method in Product something like <code>update_or_create_colors</code> that updates or creates new ProductColor, and in your controller just call that method, I don't thing there is a method in rails for your especific case.</p>