app/models/invite.rb in invitation-0.3 vs app/models/invite.rb in invitation-0.4

- old
+ new

@@ -6,10 +6,11 @@ belongs_to :invitable, polymorphic: true belongs_to :sender, class_name: Invitation.configuration.user_model_class_name belongs_to :recipient, class_name: Invitation.configuration.user_model_class_name before_create :generate_token + before_save :set_email_case, on: :create before_save :check_recipient_existence validates :email, presence: true validates :invitable, presence: true validates :sender, presence: true @@ -23,7 +24,13 @@ end def check_recipient_existence recipient = Invitation.configuration.user_model.find_by_email(email) self.recipient_id = recipient.id if recipient + end + + private + + def set_email_case + email.downcase! unless Invitation.configuration.case_sensitive_email end end