I was looking through the Devise code and noticed that most of the controllers yield the resource being created.
class Devise::RegistrationsController < DeviseController
# ...
def create
build_resource(sign_up_params)
resource.save
yield resource if block_given?
# ...
This must be some sort of extendability feature but I don't really get how you would pass a block to to the controller action?
Note: This question is about how you would actually do it in the Rails request cycle, not about how blocks in Ruby work.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…