We've got this object, @current_employer, that's acting a bit weird. Update fails the first time, succeeds the second.
(byebug) @current_employer.update(settings_params)
false
(byebug) @current_employer.update(settings_params)
true
Here's where we initialise it:
@current_employer = Employer.find(decoded_auth_token[:employer_id])
It's just a standard "find".
Current workaround:
if @current_employer.update(settings_params) || @current_employer.update(settings_params)
...
Anyone seen this before?
Update
Tracked it down to this line in a "before_save" call
# self.is_test = false if is_test.nil?
Seems like is_test
is a reserved keyword?