Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图找出谁在尝试删除特定记录。我有一个 before_destroy 回调来防止删除,但现在我试图找出是谁在做这件事。
我推荐这个
@post.request = request
然后在你的post.rb
post.rb
attr_accessor :request before_destroy :wtf private def wtf Rails.logger.warn "Person from #{request.ip} is trying to destroy, wtf!" end