lib/rodauth/oauth/database_extensions.rb in rodauth-oauth-1.4.0 vs lib/rodauth/oauth/database_extensions.rb in rodauth-oauth-1.5.0
- old
+ new
@@ -12,9 +12,13 @@
dataset.returning.insert(params).first
end
else
def __insert_and_return__(dataset, pkey, params)
id = dataset.insert(params)
+ if params.key?(pkey)
+ # mysql returns 0 when the primary key is a varchar.
+ id = params[pkey]
+ end
dataset.where(pkey => id).first
end
end
if dataset.supports_returning?(:update)