Commit f691b1fa authored by Grzegorz Bizon's avatar Grzegorz Bizon

Use falback to set token if encrypted field is missing

parent bc00b814
......@@ -24,8 +24,14 @@ module TokenAuthenticatableStrategies
# using factory bot to create resources, it might happen that a database
# schema does not have "#{token_name}_encrypted" field yet, however a bunch
# of models call `ensure_#{token_name}` in `before_save`.
#
super if instance.has_attribute?(encrypted_field)
return super if instance.has_attribute?(encrypted_field)
if fallback?
fallback_strategy.ensure_token(instance)
else
raise ArgumentError, 'Encrypted field does not exist without fallback'
end
end
def get_token(instance)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment