Sha256: 79339b180744266a73fc52e2a204cd1eb4aa7304eb8c2f0c36cad2d35db1b822

Contents?: true

Size: 874 Bytes

Versions: 1

Compression:

Stored size: 874 Bytes

Contents

module Rad
  module Processors    
    class ControllerCaller < Processor
      def call                
        # prepare
        response = workspace.response.must_be.defined
        klass = workspace.class.must_be.present
        raise "The controller class #{klass} must be a Rad::AbstractController!" unless klass.is? Rad::AbstractController
        controller = workspace.controller = klass.new                  
        action = workspace.action = workspace.method_name
        format = workspace.params.format

        # call
        
        workspace.content = catch :halt_render do
          controller.run_callbacks :action, method: action do          
            # call controller
            controller.send action

            # render view
            controller.render action: action
          end
        end
      end          
    
    end    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rad_core-0.0.13 lib/rad/controller/processors/controller_caller.rb