app/controllers/optimacms/pages_controller.rb
def renderActionInOtherController(controller,action,params, tpl_view=nil, tpl_layout=nil)

      # include render into controller class
      if current_cms_admin_user
        controller.send 'include', Optimacms::Renderer::AdminPageRenderer
        controller.send 'renderer_admin_edit'
      end



      #
      c = controller.new
      c.params = params

      if current_cms_admin_user
        #if !controller.respond_to?(:render_base, true)
        if !c.respond_to?(:render_base, true)
          controller.send :alias_method, :render_base, :render

          controller.send :define_method, "render" do |options = nil, extra_options = {}, &block|
            if current_cms_admin_user && @pagedata
              render_with_edit(options, extra_options, &block)
            else
              render_base(options, extra_options, &block)
            end

          end
        end
      end


      #c.process_action(action, request)
      #c.dispatch(action, request)
      #c.send 'index_page'

      c.request = request
      #c.request.path_parameters = params.with_indifferent_access
      c.request.format = params[:format] || 'html'

      c.action_name = action
      c.response = ActionDispatch::Response.new

      c.send 'my_set_render'
      c.send 'optimacms_set_pagedata', @pagedata
      c.send 'my_set_render_template', tpl_view, tpl_layout
      c.send 'my_set_meta', @pagedata.meta



      #renderer_admin_edit

      #c.process_action(action)
      c.dispatch(action, request, c.response)
      #c.process_action(action, tpl_filename)

      #app = "NewsController".constantize.action(action)
      #app.process params

      # result
      #c

      c.response.body

      #app.response.body
    end
def renderActionInOtherController(controller,action,params, tpl_view=nil, tpl_layout=nil)

      # include render into controller class
      if current_cms_admin_user
        controller.send 'include', Optimacms::Renderer::AdminPageRenderer
        controller.send 'renderer_admin_edit'
      end



      #
      c = controller.new
      c.params = params

      if current_cms_admin_user
        #if !controller.respond_to?(:render_base, true)
        if !c.respond_to?(:render_base, true)
          controller.send :alias_method, :render_base, :render

          controller.send :define_method, "render" do |options = nil, extra_options = {}, &block|
            if current_cms_admin_user && @pagedata
              render_with_edit(options, extra_options, &block)
            else
              render_base(options, extra_options, &block)
            end

          end
        end
      end


      #c.process_action(action, request)
      #c.dispatch(action, request)
      #c.send 'index_page'

      c.request = request
      #c.request.path_parameters = params.with_indifferent_access
      c.request.format = params[:format] || 'html'

      c.action_name = action
      c.response = ActionDispatch::Response.new

      c.send 'my_set_render'
      c.send 'optimacms_set_pagedata', @pagedata
      c.send 'my_set_render_template', tpl_view, tpl_layout
      c.send 'my_set_meta', @pagedata.meta



      #renderer_admin_edit

      #c.process_action(action)
      c.dispatch(action, request, c.response)
      #c.process_action(action, tpl_filename)

      #app = "NewsController".constantize.action(action)
      #app.process params

      # result
      #c

      c.response.body

      #app.response.body
    end
=begin
    def my_set_render_template(tpl_view, tpl_layout)
      @optimacms_tpl = tpl_view
      @optimacms_layout = tpl_layout
    end

    def my_set_meta(meta)
      #@optimacms_meta = meta
      @optimacms_meta_title = meta[:title]
      @optimacms_meta_keywords = meta[:keywords]
      @optimacms_meta_description = meta[:description]
    end
=end