I am using rails 3.2. Here! I am facing a problem, stats below.
I am having two model classes RequestedTrip and TagTrip. Here! are two other models RequestedTripAgent and Tag on which I operate in before_save callback of RequestedTrip and after_update callback of TagTrip.
There is a case in which I am facing Duplicate entry problem. The case is ...
I am updating RequestedTrip object. There is a before_save callback in which I am using find_or_create_by to find or create RequestedTripAgent object. I also assigning Tags to RequestedTrip object through which another callbacks fire in TagTrip after_update. In TagTrip after_update callback, I also using find_or_create_by of same object of RequestedTripAgent.
Here I am using find_or_create_by but getting Duplicate key index error for RequestedTripAgent. What is wrong with me?
Thanks
Aucun commentaire:
Enregistrer un commentaire