I have a form set up for a Recipes model that accepts_nested_attributes_for Ingredients. The form and saving works fine, however, I want to check for the existence of each Ingredient in the database. The form seems to be creating new records for ingredients, even if they already exist in the database.
Recipes and Ingredients are related using a 'has_many :through' relationship. Is there a clean way to make sure that ingredients are duplicated when the form is submitted, but the relationships are still established?