title: What does 'yield resource' in the Devise controllers do?
body: <p>I was looking through the Devise code and noticed that most of the controllers yield the resource being created.</p>
  
  <pre><code>class Devise::RegistrationsController &lt; DeviseController
    # ...
    def create
      build_resource(sign_up_params)
  
      resource.save
      yield resource if block_given?
      # ...
  </code></pre>
  
  <p>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?</p>
  
  <p><strong>Note:</strong> This question is about how you would actually do it in the Rails request cycle, not about how blocks in Ruby work.</p>