I actually refactored that entire method pretty significantly before seeing that you started to review. In doing so, I added the following methods to store.rb: 

```
  def find_flavor_inventory(flavor)
    flavor_inventories.where(flavor_id: flavor.id).first
  end

  def find_or_build_flavor_inventory(flavor)
    find_flavor_inventory(flavor) || flavor_inventories.build(flavor_id: flavor.id)
  end

  def delete_flavor_inventory(flavor)
    flavor_inventory = find_flavor_inventory(flavor)
    flavor_inventory.destroy if flavor_inventory
  end
```

I tried the find_or_create_by_store_id_and_flavor_id, but it didn't assign store_id properly. I believe this is because store ID is actually being generated by the create method, and thus is Nil at the time it is being passed into the method.