Rails 3: Get current namespace?
Outside the controller (e.g. in the views), use controller.class.name. You can turn this into a helper method like this:
module ApplicationHelper def admin? controller.class.name.split("::").first=="Admin" endend
In both the controller and the views, you can parse controller_path, eg.:
namespace = controller_path.split('/').first