diff --git a/lib/devise_invitable/model.rb b/lib/devise_invitable/model.rb index 998e0f1f..9452c6d8 100644 --- a/lib/devise_invitable/model.rb +++ b/lib/devise_invitable/model.rb @@ -56,6 +56,11 @@ def invite! self.skip_confirmation! if self.new_record? && self.respond_to?(:skip_confirmation!) generate_invitation_token if self.invitation_token.nil? self.invitation_sent_at = Time.now.utc + + # Call these before_validate methods since we aren't validating on save + self.downcase_keys if self.new_record? && self.respond_to?(:downcase_keys) + self.strip_whitespace if self.new_record? && self.respond_to?(:strip_whitespace) + if save(:validate => false) self.invited_by.decrement_invitation_limit! if !was_invited and self.invited_by.present? deliver_invitation unless @skip_invitation