Creation of new Record with before_validation hook fails if Bullet.enable = true
I have a rails ActiveRecord model, say AR1, with a before_validation hook. This hooks calls a function to create another ActiveRecord, say AR2, before AR1 is created.
In case Bullet is active, AR2 seems to get modified, such that a creation of AR1, which triggers first a creation of AR2, leads to:
AR2.find(the_id_which_is_the_primary_key) fails with unknown primary key
AR2.find_by(id: the_id_which_is_the_primary_key) works fine
The database and models are configured correctly. Without Bullet.enable = true everything works. Unit and feature test run green, since gem bullet is grouped under development.
Any advice?
thanks!
see error logs (AR1 -> EnergyManagementSystem, AR2 -> TechnicianGroup):
stacktrace.txt
Creation of new Record with before_validation hook fails if Bullet.enable = true
I have a rails ActiveRecord model, say
AR1
, with abefore_validation
hook. This hooks calls a function to create another ActiveRecord, sayAR2
, beforeAR1
is created.In case Bullet is active,
AR2
seems to get modified, such that a creation ofAR1
, which triggers first a creation ofAR2
, leads to:AR2.find(the_id_which_is_the_primary_key)
fails with unknown primary keyAR2.find_by(id: the_id_which_is_the_primary_key)
works fineThe database and models are configured correctly. Without
Bullet.enable = true
everything works. Unit and feature test run green, sincegem bullet
is grouped under development.Any advice?
thanks!
see error logs (
AR1 -> EnergyManagementSystem
,AR2 -> TechnicianGroup
): stacktrace.txt