def render_for_namespace view
      nmspc = params[:controller].include?('/') ? params[:controller].rpartition('/')[0] : nil
      # recurse down the namespace tree to see if we get any hits.
      until nmspc.blank?
        template = "layouts/#{nmspc}/_#{view}"
        partial = "layouts/#{nmspc}/#{view}"
        if lookup_context.template_exists?(template)
          return render(partial)
        end
        nmspc = nmspc.include?('/') ? nmspc.rpartition('/')[0] : nil
      end
    end
def render_for_namespace view
      nmspc = params[:controller].include?('/') ? params[:controller].rpartition('/')[0] : nil
      # recurse down the namespace tree to see if we get any hits.
      until nmspc.blank?
        template = "layouts/#{nmspc}/_#{view}"
        partial = "layouts/#{nmspc}/#{view}"
        if lookup_context.template_exists?(template)
          return render(partial)
        end
        nmspc = nmspc.include?('/') ? nmspc.rpartition('/')[0] : nil
      end
    end
<%= render_for_namespace 'layout_partial_name' %>

 Only renders if the current controller is namespaced.
 If the specified partial doesn't exist, no error is raised.