How can I render an action of a controller which is in a different namespace?
For example, if I have a login controller in a Webapp namespace Webapp::LoginController and I want to render the index action (not a partial!) in an events controller in the API namespace API::EventsController if the user is logged in:
class Webapp::LoginController < ApplicationController
  include Webapp::LoginHelper
  def index
    render 'events/index' if logged_in? # events#index is in the API namespace
   end
end
Is this even possible? I see the answer being no because of potential conflicts with subdomains and paths, depending on how the routes are defined.
I know I could redirect to the page I'd like with
redirect_to api_events_url
but this will create a new request which I don't necessarily want.
                        
This worked for me