I need to render another controller action <%= render \"controller/index\" %>
and i get this error
Missing partial controller/inde
This works well for me :
def renderActionInOtherController(controller,action,params)
controller.class_eval{
def params=(params); @params = params end
def params; @params end
}
c = controller.new
c.request = @_request
c.response = @_response
c.params = params
c.send(action)
c.response.body
end
then, call by
render :text => renderActionInOtherController(OtherController,:otherAction,params)
basically it hacks the other class and overwrites its "params" method and return
If you are using Rails 4:
def renderActionInOtherController(controller,action,params)
c = controller.new
c.params = params
c.dispatch(action, request)
c.response.body
end