1
我在CodeSchools教程中遇到以下代码。在after_create过滤条件中使用Proc.new if条件
class Following < ActiveRecord::Base
after_create :queue_new_follower_email,
if: Proc.new {|f| f.followed_user.receive_emails? }
end
我很困惑。 f变量是什么,它来自哪里?它是对当前模型对象的引用吗?如果是的话,我应该如何猜到它?(文档/源代码?)
我知道Proc块的语法,但我很困惑'f'变量来自哪里?