devise_invitable
devise_invitable copied to clipboard
Inviting a new user with identical params is wrongly `persisted`
Inviting a new user with identical params wrongly returns .persisted?
true but created_at
nil
attributes = {
name: 'Cosmin',
email: '[email protected]'
}
first_user = User.invite!(attributes)
puts first_user.persisted? # => true
puts first_user.created_at # => Wed, 29 Mar 2017 11:42:46 -0700
# let's try inviting the same user
second_user = User.invite!(attributes)
puts second_user.persisted? # => true
puts second_user.created_at # => nil ?!
This looks like a bug, because the second_user was not persisted, since it wasn't actually saved, yet persisted?
returns true. If a new user hasn't been added to the database, then second_user.persisted?
shouldn't return true.
Could you post sql queries or send pull request with failing test? I can't reproduce it