Devise를 설정할 때 어떤 모델이 작동하는지 (예 : User) 알려줍니다. 그 방법의 대부분은 그 클래스에 적용됩니다. 그래서 이것이 당신이 물건을 무력화하려는 곳입니다.
정확하게 읽고 있다면 정확히 무엇을하고 싶은지를 나타내는 lib/devise/models/authenticatable.rb
에있는 Devise 코드의 주석이 있습니다.
# This is an internal method called every time Devise needs
# to send a notification/mail. This can be overriden if you
# need to customize the e-mail delivery logic. For instance,
# if you are using a queue to deliver e-mails (delayed job,
# sidekiq, resque, etc), you must add the delivery to the queue
# just after the transaction was committed. To achieve this,
# you can override send_devise_notification to store the
# deliveries until the after_commit callback is triggered:
#
# class User
# devise :database_authenticatable, :confirmable
#
# after_commit :send_pending_notifications
#
# protected
#
# def send_devise_notification(notification)
# pending_notifications << notification
# end
#
# def send_pending_notifications
# pending_notifications.each do |n|
# devise_mailer.send(n, self).deliver
# end
# end
#
# def pending_notifications
# @pending_notifications ||= []
# end
# end
#
def send_devise_notification(notification)
devise_mailer.send(notification, self).deliver
end
내 user.rb 파일에 "send_devise_notification"을 추가 하시겠습니까? 나는 그것을 시도했고 호출되지 않았다 ... – AnApprentice
예, 사용자 모델에서'send_devise_notification'을 무시합니다. 나는 Devise의 최신 버전으로 알림을 가로 챌 수있었습니다 (로그에 somethig를 보냈습니다). 그러나 모든 것을 작동 시키려면 주석을 읽으십시오. 메서드를 정의하는 것뿐만 아니라'after_commit' 필터를 추가하여 지연된 작업 (또는 무엇이든) 큐를 구축해야합니다. –
감사합니다. 그러나 "send_confirmation_instructions"의 위치가 아닙니다. 해당 메소드 "send_confirmation_instructions"를 수정해야합니다. – AnApprentice