scambra/devise_invitable — Issue #135: should not clear errors if new record.
Author: mabid
Created: 2011-10-25 13:27:41+00:00
State: open

When creating an invitation I see in the model.rb _invite function the code shown below clears any errors if the email matches the regex.

if invitable.new_record?
invitable.errors.clear if invitable.email.try(:match, Devise.email_regexp)
else
invitable.errors.add(invite_key, :taken) unless invitable.invited? && self.resend_invitation
end

Let say for example i want the admin to send an invitation to user but the admin must provide a username before the invitation can be created. Either a hook should be provided to run validations separately or there should be some other work around to this. Let me know if there is one already ?

Thanks