def extends(layout, &block)
      # Make sure it's a string
      layout = layout.to_s

      # If there's no directory component, presume a plain layout name
      layout = "layouts/#{layout}" unless layout.include?('/')

      # Capture the content to be placed inside the extended layout
      @view_flow.get(:layout).replace capture(&block).to_s

      render file: layout
    end
def extends(layout, &block)
      # Make sure it's a string
      layout = layout.to_s

      # If there's no directory component, presume a plain layout name
      layout = "layouts/#{layout}" unless layout.include?('/')

      # Capture the content to be placed inside the extended layout
      @view_flow.get(:layout).replace capture(&block).to_s

      render file: layout
    end
Declares that the current layour (or view) is inheriting from and extending another layout.

 @param [String] layout
   The base name of the file in `layouts/` that you wish to extend (eg `application` for `layouts/application.html.erb`)

 @example Extending the `application` layout to create an `admin` layout

     # app/views/layouts/admin.html.erb
     <%= extends :application do %>
       ...
     <% end %>

 @example Extending the `admin` layout in a view (you'll need to render the view with `layout: nil`)

     # app/controllers/admin/posts_controller.rb
     class Admin::PostsController < ApplicationController
       # You can disable Rails' layout rendering for all actions
       layout nil

       # Or disable Rails' layout rendering per-controller
       def index
         render layout: nil
       end
     end

     # app/views/admin/posts/index.html.erb
     <%= extends :admin do %>
       ...
     <% end %>