What is the best way to get the current controller object’s namespace? From inspecting self in a current controller action, I see there is a parameter “REQUEST_URI” that contains a string like “foo_namespace/bar”, but I was wondering if there is a better way to get it than to get that (that request_uri wasn’t even accessible directly from the controller instance object, I think it was nested in some other params)?
What is the best way to get the current controller object’s namespace? From inspecting
Share
I believe you are able to do
params[:controller].split("/").first. This will return that namespace.